Differences between revisions 4 and 19 (spanning 15 versions)
Revision 4 as of 2006-02-28 03:30:38
Size: 2333
Editor: h-66-134-92-2
Comment: Added comment to code for handling 0.6.4
Revision 19 as of 2021-08-24 19:24:12
Size: 807
Editor: MarlysHook
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= The Problem =

I used [http://tgolden.sc.sabren.com/python/winshell.html winshell] from Tim Golden - a thin wrapper around Windows Shell-Functions.

winshell.py starts with
{{{
#!python
from win32com import storagecon
from win32com.shell import shell, shellcon
}}}

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.


= Explanation =

win32com does some magic. There really is no win32com.shell anywhere.

= Solution =

Without shame I browsed [http://cvs.sourceforge.net/viewcvs.py/spambayes/ spambayes source code] and found:

{{{
#!python
# ModuleFinder can't handle runtime changes to __path__, but win32com uses them,
# particularly for people who build from sources. Hook this in.
try:
    import modulefinder # in 0.6.4 use "import py2exe.mf as modulefinder"
    import win32com
    for p in win32com.__path__[1:]:
        modulefinder.AddPackagePath("win32com", p)
    for extra in ["win32com.shell","win32com.mapi"]:
        __import__(extra)
        m = sys.modules[extra]
        for p in m.__path__[1:]:
            modulefinder.AddPackagePath(extra, p)
except ImportError:
    # no build path setup, no worries.
    pass
}}}

I just added that in top of my setup.py file:

{{{
#!python
# By default, the installer will be created as dist\Output\setup.exe.

import time
import sys

# ModuleFinder can't handle runtime changes to __path__, but win32com uses them

try:
    import modulefinder # in 0.6.4 use "import py2exe.mf as modulefinder"
    import win32com
    for p in win32com.__path__[1:]:
        modulefinder.AddPackagePath("win32com", p)
    for extra in ["win32com.shell"]: #,"win32com.mapi"
        __import__(extra)
        m = sys.modules[extra]
        for p in m.__path__[1:]:
            modulefinder.AddPackagePath(extra, p)
except ImportError:
    # no build path setup, no worries.
    pass

from distutils.core import setup
import py2exe
}}}

And this worked.
<<BR>>
Hi! Let me begin by stating my name - Dirty however I do not like when individuals use my complete name. It's not a typical thing however exactly what she likes doing is mountain biking but she's believing on beginning something brand-new. Office supervising is exactly what he does for a living. North Carolina is the place I love the majority of. She's been dealing with her website for some time now. Inspect it out here: http://Www.Railroadpics.com/__media__/js/netsoltrademark.php?d=featur.vs120084.hl-users.com%2Fbys%2Findex.php%3Fmod%3Dusers%26action%3Dview%26id%3D995357<<BR>>
<<BR>>
Here is my web page - [[http://Www.Railroadpics.com/__media__/js/netsoltrademark.php?d=featur.vs120084.hl-users.com%2Fbys%2Findex.php%3Fmod%3Dusers%26action%3Dview%26id%3D995357|Marriage Help]]<<BR>>


Hi! Let me begin by stating my name - Dirty however I do not like when individuals use my complete name. It's not a typical thing however exactly what she likes doing is mountain biking but she's believing on beginning something brand-new. Office supervising is exactly what he does for a living. North Carolina is the place I love the majority of. She's been dealing with her website for some time now. Inspect it out here: http://Www.Railroadpics.com/__media__/js/netsoltrademark.php?d=featur.vs120084.hl-users.com%2Fbys%2Findex.php%3Fmod%3Dusers%26action%3Dview%26id%3D995357<<BR>>
Here is my web page - Marriage Help

win32com.shell (last edited 2021-08-24 23:35:23 by JimmyRetzlaff)