# Buggy code
def process_set(hive, hive_name, key, flags, default_arch):
    try:
        with winreg.OpenKeyEx(hive, key, access=winreg.KEY_READ | flags) as root_key:
            for company in enum_keys(root_key):
                if company == "PyLauncher":  # reserved
                    continue
                for spec in process_company(hive_name, company, root_key, default_arch):
                    yield spec
    except OSError:
        pass


# Traceback (ImportError)
$ tox -e py37
GLOB sdist-make: C:\Users\Anthony\AppData\Local\Temp\x\tox\aspy.yaml\setup.py
py37 create: C:\Users\Anthony\AppData\Local\Temp\x\tox\aspy.yaml\.tox\py37
___________________________________ summary ___________________________________
py37: commands succeeded
congratulations :)
Traceback (most recent call last):
File "C:\Users\Anthony\AppData\Local\Temp\x\tox\aspy.yaml\venv\Scripts\tox-script.py", line 11, in <module>
load_entry_point('tox', 'console_scripts', 'tox')()
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\session\__init__.py",line 44, in cmdline
main(args)
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\session\__init__.py",line 68, in main
exit_code = session.runcommand()
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\session\__init__.py",line 192, in runcommand
return self.subcommand_test()
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\session\__init__.py",line 220, in subcommand_test
run_sequential(self.config, self.venv_dict)
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\session\commands\run\sequential.py", line 9, in run_sequential
if venv.setupenv():
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\venv.py", line 595, in setupenv
status = self.update(action=action)
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\venv.py", line 253, in update
self.hook.tox_testenv_create(action=action, venv=self)
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\hooks.py", line 289, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\manager.py", line 68, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\manager.py", line 62, in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\callers.py", line 208, in _multicall
return outcome.get_result()
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\callers.py", line 81, in get_result
_reraise(*ex)  # noqa
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\venv.py", line 665, in tox_testenv_create
config_interpreter = venv.getsupportedinterpreter()
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\venv.py", line 294, in getsupportedinterpreter
return self.envconfig.getsupportedinterpreter()
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\config\__init__.py", line 953, in getsupportedinterpreter
info = self.config.interpreters.get_info(envconfig=self)
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\interpreters\__init__.py", line 32, in get_info
executable = self.get_executable(envconfig)
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\interpreters\__init__.py", line 26, in get_executable
exe = self.hook.tox_get_python_executable(envconfig=envconfig)
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\hooks.py", line 289, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\manager.py", line 68, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\manager.py", line 62, in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\callers.py", line 208, in _multicall
return outcome.get_result()
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\callers.py", line 81, in get_result
_reraise(*ex)  # noqa
File "c:\users\anthony\appdata\local\temp\x\tox\aspy.yaml\venv\lib\site-packages\pluggy\callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\interpreters\windows\__init__.py", line 21, in tox_get_python_executable
py_exe = locate_via_pep514(spec)
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\interpreters\windows\__init__.py", line 45, in locate_via_pep514
from . import pep514
File "c:\users\anthony\appdata\local\temp\x\tox\src\tox\interpreters\windows\pep514.py", line 8, in <module>
import winreg
ImportError: No module named winreg

# Fixed code
def process_set(hive, hive_name, key, flags, default_arch):
    try:
        with winreg.OpenKeyEx(hive, key, 0, winreg.KEY_READ | flags) as root_key:
            for company in enum_keys(root_key):
                if company == "PyLauncher":  # reserved
                    continue
                for spec in process_company(hive_name, company, root_key, default_arch):
                    yield spec
    except OSError:
        pass