1

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

3
  • are you on a 32-bit windows or 64? Commented Oct 23, 2012 at 15:35
  • You'll probably need to install sourceforge.net/projects/pywin32 yourself or use a distribution (such as ActiveState's) that includes it. Commented Oct 23, 2012 at 15:35
  • @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 Commented Oct 23, 2012 at 15:51

2 Answers 2

1

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!

Sign up to request clarification or add additional context in comments.

1 Comment

404 not found. This is why SO has a policy of copying in the full answer, and not just linking to ephemeral web sites. If the page or site goes away, at least the information remains here.
1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.