McMillan's Installer problem with win32com
Mark Hammond
MarkH at ActiveState.com
Tue Aug 1 07:39:49 EDT 2000
"richard_chamberlain" <richard_chamberlain at ntlworld.com> wrote in message
news:d8yh5.309$8N1.4906 at news6-win.server.ntlworld.com...
> Hi,
>
> If you do a search on your drive for pywintypes15.dll you'll find the
file.
> Make a copy of it and change the name to pywintypes.dll and it should
work.
> It hasn't worked on all my work with com but at least some of it.
It won't work with anything that links against pythoncom - eg, active
scripting, or any other "win32com extension".
Below is some code I use to get around the "wrong name" problem with the
DLL.
# pythoncom and pywintypes are special, and require these hacks when
# built into a .EXE
def magic_import(modulename, filename):
# win32 can find the DLL name.
h = win32api.LoadLibrary(filename)
found = win32api.GetModuleFileName(h)
# Python can load the module
mod = imp.load_module(modulename, None, found, ('.dll', 'rb',
imp.C_EXTENSION))
# inject it into the global module list.
sys.modules[modulename] = mod
# And finally inject it into the namespace.
globals()[modulename] = mod
win32api.FreeLibrary(h)
try:
import pywintypes
except ImportError:
magic_import("pywintypes", "pywintypes15.dll")
try:
import pythoncom
except ImportError:
magic_import("pythoncom", "pythoncom15.dll")
Mark.
>
> Richard
> <ryzam at my-deja.com> wrote in message news:8m67q0$h9g$1 at nnrp1.deja.com...
> > Hi,
> >
> > I'm getting trouble to compile with McMillan's Installer on wxPython
> > GUI application that import win32com module.
> > No error when running in interpreter mode like python mycoding.py.
> >
> > This is an example in my coding that using win32com module
> > class ComInternetExplorer:
> > '''An interfce to Microsoft Internet Explorer using COM.
> > The MSIE objects can be used directly, this class just wraps some
of
> > the
> > behaviors for convenience.
> > jjk 09/02/99'''
> >
> > def __init__(self, visible=1, timeout=200, waitInterval=1):
> > '''Initialize the receiver: opens an Internet Explorer application
> > jjk 09/02/99'''
> > self.ie = win32com.client.Dispatch("InternetExplorer.Application")
> > self.ie.Visible = visible
> > #self.ie.StatusBar=0
> > #self.ie.Width=400
> > #self.ie.Height=400
> > #self.ie.ToolBar=0
> > self.timeout = timeout # seconds before waitWhileBusy() times out
> > self.waitInterval = waitInterval # interval (seconds) between busy
> > tests
> >
> > bla bla.....continue coding here....
> >
> > I get the following error when i run python Standalone.py:
> > Traceback (innermost last):
> > File "Builder.py", line 502, in ?
> > main(opts,args)
> > File "Builder.py", line 484, in main
> > target.build()
> > File "Builder.py", line 87, in build
> > self.assemble()
> > File "Builder.py", line 234, in assemble
> > shutil.copy2(path,self.name)
> > File "C:\Program Files\Python\Lib\shutil.py",
> > copyfile(src,dst)
> > File "C:\Program Files\Python\Lib\shutil.py",
> > fsrc=open(src,'rb')
> > IOError:[Errno 2] No such file or
> > directory: 'c:\\windows\\system\\pywintypes.dll'
> >
> >
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
>
More information about the Python-list
mailing list