win32com import error python 3.4

foosion picture foosion · Mar 18, 2014 · Viewed 39.9k times · Source

I just installed python 3.4 64bit and tried to install win32com. I have downloaded pywin32-218.win-amd64-py3.4.exe and ran it without any problem. pip freeze reports pywin32==218. However, when I try to import win32com.client I get following error:

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    import win32com.client
  File "C:\program files\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.

sys and os import without issue. import win32api is the problem.

Using the same procedure it worked fine for python 2.7.6 and python 3.3.4.

How can I fix this?

Answer

David Woakes picture David Woakes · Apr 2, 2014

This worked without needing to copy DLLs in python 3.3.

Why do these need to be copied as in 2.6? Surely this should be fixed by now!

After some additional research I found that all you need to do is run the post install script as administrator.

python C:\Python34\Scripts\pywin32_postinstall.py -install

It appears that the install script isn't doing this step correctly.