pywin32 icon indicating copy to clipboard operation
pywin32 copied to clipboard

No Module named 'pywintypes'

Open ghost opened this issue 8 years ago • 5 comments

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 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 import pythoncom File "C:\Users\foo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pythoncom.py", line 2, in 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

Reported by: jbarker2160

Original Ticket: pywin32/bugs/755

ghost avatar Aug 10 '17 18:08 ghost

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"

Original comment by: mhammond

ghost avatar Aug 11 '17 02:08 ghost

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.

Original comment by: xaav

ghost avatar Aug 15 '17 16:08 ghost

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"

Original comment by: mhammond

I executed that command successfully and still same errors occurs.

simryang avatar Jun 26 '20 00:06 simryang

I have an amd64 bit and I'm having the same issue.

GEOJOEco avatar Aug 30 '22 13:08 GEOJOEco

@jbarker2160 @GEOJOEco Can you confirm if you still have this issue specifically on the most recent version of pywin32 (306 as of writing this comment), on Python >= 3.8, installing from pip ? As well as an updated traceback log if you get one.

Avasam avatar Mar 20 '24 18:03 Avasam