enthought / enthought/comtypes
Uncaught COMError with Automation in shell results in a leak
- Dominant language
- Python
- Stars
- 345
- Forks
- 105
- PR merge metrics
- No merged PRs in 30d
Description
In either the CPython or IPython interactive shells:
``` python
>>> import comtypes.client
>>> xl = comtypes.client.CreateObject('Excel.Application', dynamic=True)
>>> wb = xl.Workbooks.Open('nonexistent.xlsx')
Traceback (most recent call last):
File "", line 1, in
File "C:\Python33\lib\site-packages\comtypes\client\lazybind.py", line 182, in caller
return self._comobj._invoke(descr.memid, descr.invkind, 0, *args)
File "C:\Python33\lib\site-packages\comtypes\automation.py", line 729, in _invoke
dp, var, None, argerr)
_ctypes.COMError: (-2146827284, None, ("'nonexistent.xlsx' could not be found. Check the spelling of the file name, and verify that the file location is correct.\n\nIf you are trying to open the file from your list of most recently used files, make sure that the file has not been renamed, moved, or deleted.", 'Microsoft Office Excel', 'C:\\Program Files (x86)\\Microsoft Office\\Office12\\1033\\XLMAIN11.CHM', 0, None))
>>> xl.Quit()
>>> del xl
```
Task Manager shows that an EXCEL.EXE instance still lingers. If I wrap the above inside a try statement with `except: pass`, then Excel shuts down.
Contributor guide
Assessment
This issue has not been assessed yet.