[python-win32] [OT] importing win32com.shell - RESOLVED

Reed L. O'Brien reed at intersiege.com
Wed Feb 22 23:12:54 CET 2006



Reed L. O'Brien wrote:
> Hello:
> 
> I wrote a quickie script to get word and charatcer counts from word
> documents using Tim Golden's winshell module.
> 
> When I py2exe it it doesn't pull in shell from win32com.shell, since it
> appears, to me, to be in win32comext instead of win32com. Is there a
> standard way to deal with this or do I need to go name it manually in my
> py2exe setup file (which I tried while running out the door yesterday
> without sucess)?
> 
> Thanks,
> ~reed
> 
> 

Answering my own question for the record:
Sorry for the OT post in the first place.

Because of some magic that the win32 wizards cast, py2exe doesn't find
win32com.shell.

import sys

try:
    import 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

The answer was here:
http://starship.python.net/crew/theller/moin.cgi/WinShell

Best regards and thanks to all who make python such a great language...
~reed

-- 
4.6692916090
'cmVlZEBpbnRlcnNpZWdlLmNvbQ==\n'.decode('base64')
http://www.spreadfirefox.com/?q=affiliates&id=16474&t=1
keyID: 0x0FA09FCE


More information about the Python-win32 mailing list