enthought / enthought/comtypes

comtypes 1.1.3 hangs when importing CreateObject as non admin user

Open
#124 14 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Python
Stars
345
Forks
105
PR merge metrics
No merged PRs in 30d

Description

This happens if you import first an admin user, as admin user in python run

`from comtypes.client import CreateObject`

This works, then as an ordinary user run the same command.

I get the following tracebacks when I interrupt with control c (I had to do this as the process hangs).
```python
Traceback (most recent call last):
File "C:\Program Files\Python35\lib\tempfile.py", line 260, in _mkstemp_inner
fd = _os.open(file, flags, 0o600)
PermissionError: [Errno 13] Permission denied: 'C:\\Program Files\\Python35\\lib\\site-packages\\comtypes\\gen\\tmpmcqbrj43

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "C:\Program Files\Python35\lib\site-packages\comtypes\client\__init__.py", line 33, in
gen_dir = _find_gen_dir()
File "C:\Program Files\Python35\lib\site-packages\comtypes\client\_code_cache.py", line 30, in _find_gen_dir
if not _is_writeable(gen.__path__):
File "C:\Program Files\Python35\lib\site-packages\comtypes\client\_code_cache.py", line 110, in _is_writeable
tempfile.TemporaryFile(dir=path[0])
File "C:\Program Files\Python35\lib\tempfile.py", line 549, in NamedTemporaryFile
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
File "C:\Program Files\Python35\lib\tempfile.py", line 260, in _mkstemp_inner
fd = _os.open(file, flags, 0o600)
KeyboardInterrupt
```
Deleting the gen folder allows the non admin user to import CreateObject.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.