py2exe for WMI

Tim Golden tim.golden at viacom-outdoor.co.uk
Wed May 25 04:10:23 EDT 2005


[Thomas Heller]
| 
| Tim Golden schrieb:
| > [Thomas Heller]
| > 
| > [... snip problems with py2exe & WMI ...]
| > 
| > | The OP of the thread Tim mentions here already had a 
| solution, if I 
| > | understood him correctly, and the other things that were 
| suggested 
| > | didn't work.  Basically, IIUC, he did add the typelib 
| > | wrappers from the 
| > | 'other' windows version manually to the library.zip file.
| > | 
| > | Totally different solutions would be:
| > | - change Tim's wmi.py module so that it works with dynamic 
| > | binding (no 
| > | typelib wrappers needed)
| > | or
| > 
| > Well, if it helps, there's a version of the WMI module
| > that uses dynamic binding on my site:
| > 
| > http://timgolden.me.uk/python/downloads/wmi-0.6a.py
| > 
| > I've hardcoded the relevant constants (which is pretty 
| > much all I was using early binding for) and replaced 
| > any other EnsureDispatch calls with simple Dispatch.
| 
| It may be dangerous since the constants may or may not be the same on 
| different versions, at least in theory.  I've appended a small module 
| which allows to bind constants from the type library at runtime.
| Not much error checking, but you may get the idea.  I'll 
| leave providing 
| a proper patch for pywin32, if it makes sense, to those that 
| have more 
| time ;-)

OK. I've uploaded a version 0.6b to my site:

http://timgolden.me.uk/python/downloads/wmi-0.6b.py

which uses Thomas' ProvideConstants class and dynamic
dispatch throughout. Testers welcome!

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



More information about the Python-list mailing list