Skip to content

comtypes 1.1.3 hangs when importing CreateObject as non admin user #124

@woakesd

Description

@woakesd

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).

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 "<stdin>", line 1, in <module>
  File "C:\Program Files\Python35\lib\site-packages\comtypes\client\__init__.py", line 33, in <module>
    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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions