converted to 1.6 markup
real problem caused by this module
|Deletions are marked like this.||Additions are marked like this.|
|Line 1:||Line 1:|
|## page was renamed from WinShell|
I used winshell from Tim Golden - a thin wrapper around Windows Shell-Functions.
winshell.py starts with
py2exe learns, that something is missing:
The following modules appear to be missing ['Interface', 'intSet', 'mxDateTime.__version__', 'win32com.shell']
and starting the programm leaves:
Traceback (most recent call last): File "xxxxxx.py", line 33, in ? File "xxxxxxx.pyo", line 9, in ? File "winshell.pyo", line 27, in ? ImportError: No module named shell
in the log.file.
win32com does some magic in order to allow loading of COM extensions during run time. The actual extensions reside in the win32comext directory under site-packages and can't be loaded directly. win32com's __path__ variable has been changed to point to both win32com and win32comext. py2exe's modulefinder can't handle runtime changes in path so we have to tell it about the change beforehand.
Without shame I browsed Spambayes source code and found the code to fix it.
1 # By default, the installer will be created as dist\Output\setup.exe. 2 3 import time 4 import sys 5 6 # ModuleFinder can't handle runtime changes to __path__, but win32com uses them 7 8 try: 9 # if this doesn't work, try import modulefinder 10 import py2exe.mf as modulefinder 11 import win32com 12 for p in win32com.__path__[1:]: 13 modulefinder.AddPackagePath("win32com", p) 14 for extra in ["win32com.shell"]: #,"win32com.mapi" 15 __import__(extra) 16 m = sys.modules[extra] 17 for p in m.__path__[1:]: 18 modulefinder.AddPackagePath(extra, p) 19 except ImportError: 20 # no build path setup, no worries. 21 pass 22 23 from distutils.core import setup 24 import py2exe 25 26 # ... 27 # The rest of the setup file. 28 # ...
And this worked.