DLL error importing win32api on windows 10

user3885927 picture user3885927 · Jan 5, 2015 · Viewed 19.6k times · Source

I have python 2.7.2 on windows 10. When I load win32api and wmi it fails to load. The python install on windows 10 is same as on another windows 7 PC. I don't have this issue on win 7. Below are the errors I get when I try to import the above modules on windows 10.

>>> import win32api
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.


>>> import wmi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\Python27\lib\site-packages\wmi.py", line 88, in <module>
    from win32com.client import GetObject, Dispatch
  File "c:\Python27\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.

What could be the cause for my issue? Is there a minimum python version that is supposed to be used with windows 10?

Answer

jaqHollow picture jaqHollow · Mar 2, 2016

I can't reproduce this now, but I'll take a shot, as I had a similar problem some time ago and was able to resolve it by this solution: import win32api error in Python 2.6

I Basically copied pythoncom27.dll and pywintypes27.dll from Python27/Lib/site-packages/pywin32_system32 to Python27/Lib/site-packages/win32 ... Or something to that effect.

Sorry for the vagueness - but it helped me (found the link in my bookmarks).

Hope it helps!