#661 DLL load failed on Python 3.4b1

v1.0 (example)
open
nobody
None
5
2014-06-22
2013-12-12
Jason R. Coombs
No

I've installed pywin32 218 for amd64, but after installing, import win32com yields:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\python\lib\site-packages\win32com__init__.py", line 5, in <module>
import win32api, sys, os
ImportError: DLL load failed: The specified module could not be found.

This is on Python 3.4b1 64-bit. I suspect this is simply an API incompatibility with the early-compiled release for 3.4. Is a new release required, or is the current 218 release expected to work with 3.4b1?

Discussion

  • Digging into the issue a bit, I inspected the .pyd file with Dependency Walker and found that it's unable to load pywintypes34.dll. I see that file is installed at $Lib/site-packages/pywin32_system32.

    Doing a search around, it appears the issue is that the post install isn't being invoked. Perhaps I'm not invoking the installer with the proper privileges.

     
  • I ran the installer using "Run as Administrator" from Windows explorer, and it seemed to install just fine this time. Sorry for the noise.

     
  • The problem has re-emerged, apparently spontaneously. I uninstalled and re-installed (again using Run as Administrator), and the problem persists.

     
  • I was able to work around the issue by running pywin32_postinstall.py -install; I won't be surprised if the issue arises again. I'm using Windows 8.1. Perhaps it has some protections against installing files to System32?

     
  • Gary Dyrkacz
    Gary Dyrkacz
    2014-03-18

    I just ran into the same issue using the just officially released python 3.4.0 64 bit version. I am also using Windows 8.1 64 bit. The workaround by J. Coombs also worked for me. Other than that I had to revert to python 3.3.5 with the pywin32 3.3 extensions to use win32com; I don't have the python working skills to add much more information than a confirmation of the problem.

     
  • echion
    echion
    2014-03-18

    In case it's relevant, with a non-official installer (from http://www.lfd.uci.edu/~gohlke/pythonlibs/#pywin32 ), I had this symptom on Windows 7 x64 using Python 3.4.0 32 bit:

    set PATH=C:\Python34\Scripts;C:\Python34;C:\Windows;C:\Windows\System32
    C:\Python34\python -E -c "import win32com"
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Python34\lib\site-packages\win32com\__init__.py", line 5, in <module>
        import win32api, sys, os
    ImportError: DLL load failed: The specified module could not be found.
    

    I tried running the installer using "Run as administrator" didn't help. I finally just copied the files:

    copy C:\Python34\lib\site-packages\pywin32_system32\py*.dll C:\Python34
    
     
    Last edit: echion 2014-03-18
  • Nicola Musatti
    Nicola Musatti
    2014-03-23

    I have the same problem with the win32 official build for 3.4.0 on Windows 7 64 bit. Installing pywin32 as administrator did not solve it, but running pywin32_postinstall.py -install as suggested did.