Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

win32com import error python 3.4 [duplicate]

Tags:

python

pywin32

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?

like image 367
foosion Avatar asked Mar 18 '14 20:03

foosion


2 Answers

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.

like image 123
David Woakes Avatar answered Oct 16 '22 22:10

David Woakes


After I copied pywintypes26.dll and pythoncom26.dll to c:\Python26\Lib\site-packages\win32 I solved the problem!

quoted from here

like image 22
TankorSmash Avatar answered Oct 16 '22 20:10

TankorSmash