1
votes

When I try to:

from win32com.client import Dispatch

in Python I get the error:

Traceback (most recent call last): File "", line 1, in from win32com.client import Dispatch File "C:\Users\Lynn\Documents\2e master\masterproef\python\lib\site-packages\win32com__init__.py", line 5, in import win32api, sys, os ImportError: No module named win32api

I already tried to copy the files pythoncom27.dll and pythonwintypes27.dll to python\lib\site-packages\win32 and python\lib\site-packages\win32com but that didn't help.

I've installed pywin32-217.win32-py2.7.‌exe from http://www.lfd.uci.edu/~gohlke/pythonlibs/

I've also already searched for duplicated files with no success either.

I've installed other packages (numpy, ...) before and they all worked perfectly.

I'm using Python 2.7

2
are you on a 32-bit windows or 64? – Corey Goldberg
You'll probably need to install sourceforge.net/projects/pywin32 yourself or use a distribution (such as ActiveState's) that includes it. – Wooble
@CoreyGoldberg : my windows is 64bit. But I use IDLE which is a python GUI that works with 32 bit (I think... At top the in the shell it sais: Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 – LynnH

2 Answers

1
votes

I've solved my problem :-) After some more google-ing I finally found something that helped:

http://www.python-forum.org/pythonforum/viewtopic.php?f=15&t=17163&p=156600

When I ran the .exe file with " selecting fix compatibility problem" everything magically worked!

1
votes

This fixed the issue for me

https://pypi.python.org/pypi/pypiwin32

pip install pypiwin32

That will work in a virtualenv, or with tox, etc