comtypes
comtypes copied to clipboard
If `PATH` is not defined, importing `comtypes` fails on Windows
We've noticed that on some (rare) Windows devices, if PATH is not set or not readable when the application launches, comtypes crashes on import. The following stack trace illustrates the issue:
Traceback (most recent call last):
<...>
File "comtypes\client\__init__.pyc", line 21, in <module>
File "comtypes\client\_events.pyc", line 8, in <module>
File "comtypes\client\_generate.pyc", line 18, in <module>
KeyError: 'PATH'
Instead of expecting PATH to be defined, the code in _generate.py should fall back gracefully rather than break imports.