Hi Teja,

I ran into this problem too a while ago and found the following code on the web after someone directed me to query Google in the right way...

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

    # if this doesn't work, try import modulefinder
    import py2exe.mf as modulefinder
    import win32com
    for p in win32com.__path__[1:]:
        modulefinder.AddPackagePath("win32com", p)
    for extra in ["win32com.shell"]: #,"win32com.mapi"
        m = sys.modules[extra]
        for p in m.__path__[1:]:
            modulefinder.AddPackagePath(extra, p)
except ImportError:
    # no build path setup, no worries.

---end code---
Add that somewhere to the top of your setup.py (in mine, it is just before importing setup from distutils.core and py2exe, but just after importing time and sys).

Cheers and much luck with it,


On Mon, May 26, 2008 at 2:39 PM, Tejovathi P <tejovathi.p@gmail.com> wrote:
Hi Norm..
Thanks for your reply,.. I tried to include the win32com package using "includes" option as well as "package" option. But still
the same error reappears " Import error: No module named shell" !!
Any pointers????

On 5/23/08, Norm Petterson <njp@njp.us> wrote:

On Fri, May 23, 2008 at 8:18 AM, Tejovathi P <tejovathi.p@gmail.com> wrote:

I opened pythonwin and tried importing wincom.shell. Its working fine.....!!!!! Then where am I doing wrong....

Hello Tejovathi,

Googling py2exe win32com gave this reference among the first few:


containing this clue:

The final wrinkle in this exercise is packaging using py2exe. Win32com needs to be added as a package in the setup.py,



This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
Py2exe-users mailing list