Menu

#740 ImportError: No system module 'pywintypes' (pywintypes36.dll)

v1.0 (example)
open
nobody
None
5
2017-01-04
2017-01-03
kuno
No

I downloaded and "pip install"-ed pywin32 from http://www.lfd.uci.edu/~gohlke/pythonlibs/f9r7rmd8/pywin32-220.1-cp36-cp36m-win32.whl, as PyPI does not seem to serve a precompiled version compatible with Python 3.6.

Now, I am facing the following import error:

>>> import pywintypes
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\mek\AppData\Local\Programs\Python\Python36-32\lib\site-packages\win32\lib\pywintypes.py", line 124, in <module>
    __import_pywin32_system_module__("pywintypes", globals())
  File "C:\Users\mek\AppData\Local\Programs\Python\Python36-32\lib\site-packages\win32\lib\pywintypes.py", line 98, in __import_pywin32_system_module__
    raise ImportError("No system module '%s' (%s)" % (modname, filename))
ImportError: No system module 'pywintypes' (pywintypes36.dll)

In fact, as Process Monitor shows, the corresponding storage location "C:\Users\mek\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\pywin32_system32\" is not even scanned by python.exe. Instead, many search paths ending with "/<stdin>" show up.

[... (a lot of entries from %PATH%) ...]
12:37:26.9899610    python.exe  7368    CreateFile  C:\Users\mek\AppData\Local\Programs\Python\Python36-32\pywintypes36.dll NAME NOT FOUND  Desired Access: Read Attributes, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Open Reparse Point, Attributes: N, ShareMode: None, AllocationSize: n/a
12:37:26.9900549    python.exe  7368    CreateFile  C:\Users\mek\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\win32\lib\pywintypes36.dll NAME NOT FOUND  Desired Access: Read Attributes, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Open Reparse Point, Attributes: N, ShareMode: None, AllocationSize: n/a
12:37:26.9905114    python.exe  7368    CreateFile  C:\<stdin>  NAME INVALID    Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a
12:37:26.9906117    python.exe  7368    CreateFile  C:\<stdin>  NAME INVALID    Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a
12:37:26.9906786    python.exe  7368    CreateFile  C:\Users\mek\AppData\Local\Programs\Python\Python36-32\python36.zip\<stdin> PATH NOT FOUND  Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a
12:37:26.9907763    python.exe  7368    CreateFile  C:\Users\mek\AppData\Local\Programs\Python\Python36-32\DLLs\<stdin> NAME INVALID    Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a
12:37:26.9909128    python.exe  7368    CreateFile  C:\Users\mek\AppData\Local\Programs\Python\Python36-32\Lib\<stdin>  NAME INVALID    Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a
12:37:26.9909895    python.exe  7368    CreateFile  C:\Users\mek\AppData\Local\Programs\Python\Python36-32\<stdin>  NAME INVALID    Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a
12:37:26.9910751    python.exe  7368    CreateFile  C:\Users\mek\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\<stdin>    NAME INVALID    Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a
12:37:26.9911617    python.exe  7368    CreateFile  C:\Users\mek\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\win32\<stdin>  NAME INVALID    Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a
12:37:26.9912590    python.exe  7368    CreateFile  C:\Users\mek\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\win32\lib\<stdin>  NAME INVALID    Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a
12:37:26.9913468    python.exe  7368    CreateFile  C:\Users\mek\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\pythonwin\<stdin>  NAME INVALID    Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a

Discussion

  • kuno

    kuno - 2017-01-03

    When looking at the PyPI-counterpart of https://github.com/pywin32/pypiwin32/blob/master/pywin32.pth, the following two lines are missing:

    import os;os.environ["PATH"]+=(';'+os.path.join(sitedir,"pywin32_system32"))
    

    This looks quite hacky to me (Python code in a text file, references to a non-declared sitedir variable), but this get things working.

    (The background is that _win32sysloader.LoadModule(filename) actually uses LoadLibrary() under the hood. I have no idea about the origin of the <stdin> postfixes, though.)

     

    Last edit: kuno 2017-01-04
  • Xaav

    Xaav - 2017-01-03

    I'm working with the pypiwin32 group to have a compiled version up soon. I don't think it will be too long.

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.