Menu

#755 No Module named 'pywintypes'

v1.0 (example)
open
nobody
None
5
2017-08-15
2017-08-10
Jbarker2160
No

Here is the output when I try to run a script:

Traceback (most recent call last):
File "C:\Users\foo\Python\Python35\outlooktest.py", line 1, in <module>
from win32com.client import Dispatch, GetObject
File "C:\Users\foo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\win32com__init__.py", line 7, in <module>
import pythoncom
File "C:\Users\foo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pythoncom.py", line 2, in <module>
import pywintypes
ModuleNotFoundError: No module named 'pywintypes'

Package was instralled from pypi through pip.

Also had to modify the init script for win32com by changing the line import win32pi, sys, os to two lines:

from win32 import win32api
import sys, os

Discussion

  • Mark Hammond

    Mark Hammond - 2017-08-11

    Sadly installing via pip has issues due to the fact it doesn't run the postinstall script. You could try manually running "python pywin32_postinstall.py -install"

     
  • Xaav

    Xaav - 2017-08-15

    First, I haven't seen this issue on win_amd64. Second, @Mark Hammond Python has implemented PEPs (cannot recall numbers off the top of my head) that explicitly discourage postinstall scripts, due to a number of issues that wheel was designed to solve.