comtypes icon indicating copy to clipboard operation
comtypes copied to clipboard

If `PATH` is not defined, importing `comtypes` fails on Windows

Open maxbelanger opened this issue 7 years ago • 0 comments

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.

maxbelanger avatar Mar 14 '17 01:03 maxbelanger