# Buggy code
def load_data(self):
    result = super().load_data()

    for key, vcs in list(result.items()):
        try:
            supported = vcs.is_supported()
        except Exception as error:
            supported = False
            self.errors[vcs.name] = str(error)

        if not supported:
            result.pop(key)

    return result


# Traceback (FileNotFoundError)
$ weblate list_versions
WARNING Handled exception: FileNotFoundError: [Errno 2] No such file or directory: 'hg'
Traceback (most recent call last):
File "/home/weblate/weblate-env/bin/weblate", line 8, in <module>
sys.exit(main())
File "/home/weblate/weblate-env/lib/python3.8/site-packages/weblate/runner.py", line 32, in main
execute_from_command_line(argv)
File "/home/weblate/weblate-env/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/home/weblate/weblate-env/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/weblate/weblate-env/lib/python3.8/site-packages/django/core/management/base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/weblate/weblate-env/lib/python3.8/site-packages/weblate/utils/management/base.py", line 42, in execute
return super().execute(*args, **options)
File "/home/weblate/weblate-env/lib/python3.8/site-packages/django/core/management/base.py", line 369, in execute
output = self.handle(*args, **options)
File "/home/weblate/weblate-env/lib/python3.8/site-packages/weblate/trans/management/commands/list_versions.py", line 38, in handle
for version in get_versions_list():
File "/home/weblate/weblate-env/lib/python3.8/site-packages/weblate/utils/requirements.py", line 238, in get_versions_list
+ get_optional_versions()
File "/home/weblate/weblate-env/lib/python3.8/site-packages/weblate/utils/requirements.py", line 127, in get_optional_versions
if HgRepository.is_supported():
File "/home/weblate/weblate-env/lib/python3.8/site-packages/weblate/vcs/base.py", line 322, in is_supported
version = cls.get_version()
File "/home/weblate/weblate-env/lib/python3.8/site-packages/weblate/vcs/base.py", line 331, in get_version
cls._version = cls._get_version()
File "/home/weblate/weblate-env/lib/python3.8/site-packages/weblate/vcs/mercurial.py", line 237, in _get_version
output = cls._popen(["version", "-q"], merge_err=False)
File "/home/weblate/weblate-env/lib/python3.8/site-packages/weblate/vcs/base.py", line 158, in _popen
process = subprocess.Popen(
File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'hg'

# Fixed code
def load_data(self):
    result = super().load_data()

    for key, vcs in list(result.items()):
        try:
            version = vcs.get_version()
        except Exception as error:
            supported = False
            self.errors[vcs.name] = str(error)
        else:
            supported = vcs.is_supported()
            if not supported:
                self.errors[vcs.name] = f"Outdated version: {version}"

        if not supported or not vcs.is_configured():
            result.pop(key)

    return result