py2exe: "ImportError: No module named pywintypes" ...?? :-(

x-herbert steinhardt at inpro.de
Thu Aug 7 07:01:39 EDT 2003


Hi,

I have a small test to "compile" al litle script as a WMI-Tester. The
script include a wmi-wrapper and "insert" the Win32-modeles.

here the code:

my "WMI-Tester.py"
-----
import wmi
computer = wmi.WMI () 
for item in computer.Win32_Process (): 
  print item
-----

the WMI-Wrapper
----
...
import win32com.client
import pywintypes
...
=> look at http://tgolden.sc.sabren.com/python/wmi.html
-----

the py2exe-setup.py
-----
from distutils.core import setup
setup(name="WMI_tester", scripts=["WMI_tester.py"],)
-----

and the error at 
"setup.py py2exe":
>>> running py2exe
running build
running build_scripts
not copying WMI_tester.py (up-to-date)
running install_scripts
not copying build\scripts-2.2\mailtest.py (output up-to-date)
not copying build\scripts-2.2\script11.py (output up-to-date)
not copying build\scripts-2.2\watchdog.py (output up-to-date)
not copying build\scripts-2.2\wmi.py (output up-to-date)
not copying build\scripts-2.2\WMI_tester.py (output up-to-date)
+----------------------------------------------------
| Processing script WMI_tester.py with py2exe-0.4.1
+----------------------------------------------------
Searching modules needed to run 'WMI_tester.py' on path:
['C:\\Dokumente und Einstellungen\\steinha\\Eigene
Dateien\\WinProcess\\PythonProc\\build\\bdist.win32\\winexe\\lib\\Programme\\ActivePython22\\Lib\\site-packages',
'', 'C:\\Programme\\ActivePython22\\Lib\\site-packages\\Pythonwin',
'C:\\Programme\\ActivePython22\\Lib\\site-packages\\win32',
'C:\\Programme\\ActivePython22\\Lib\\site-packages\\win32\\lib',
'C:\\Programme\\ActivePython22\\Lib\\site-packages',
'C:\\Programme\\ActivePython22\\DLLs',
'C:\\Programme\\ActivePython22\\lib',
'C:\\Programme\\ActivePython22\\lib\\lib-tk',
'C:\\Programme\\ActivePython22',
'C:\\Programme\\ActivePython22\\lib\\site-packages\\Numeric',
'C:\\Programme\\ActivePython22\\lib\\site-packages\\PIL',
'C:\\Dokumente und Einstellungen\\steinha\\Eigene
Dateien\\WinProcess\\PythonProc']
Traceback (most recent call last):
  File "C:\Programme\ActivePython22\Lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",
line 301, in RunScript
    exec codeObject in __main__.__dict__
  File "C:\Dokumente und Einstellungen\steinha\Eigene
Dateien\WinProcess\PythonProc\setup-py2exe.py", line 7, in ?
    setup(name="WMI_tester", scripts=["WMI_tester.py"],)
  File "C:\Programme\ActivePython22\lib\distutils\core.py", line 138,
in setup
    dist.run_commands()
  File "C:\Programme\ActivePython22\lib\distutils\dist.py", line 893,
in run_commands
    self.run_command(cmd)
  File "C:\Programme\ActivePython22\lib\distutils\dist.py", line 913,
in run_command
    cmd_obj.run()
  File "C:\Programme\ActivePython22\Lib\site-packages\py2exe\build_exe.py",
line 604, in run
    mf.import_hook(f)
  File "C:\Programme\ActivePython22\Lib\site-packages\py2exe\tools\modulefinder.py",
line 126, in import_hook
    q, tail = self.find_head_package(parent, name)
  File "C:\Programme\ActivePython22\Lib\site-packages\py2exe\tools\modulefinder.py",
line 180, in find_head_package
    raise ImportError, "No module named " + qname
ImportError: No module named pywintypes

In the python-enviroment works the script fine - why the
import-error???

CU Ingolf




More information about the Python-list mailing list