McMillan's Installer problem with win32com
ryzam at my-deja.com
ryzam at my-deja.com
Tue Aug 1 21:31:44 EDT 2000
In article <9Gyh5.18201$4p3.145769 at news-server.bigpond.net.au>,
"Mark Hammond" <MarkH at ActiveState.com> wrote:
> "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.
>
Mark,
Where should i write this code??
Thanks..
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list