py2exe for WMI

Thomas Heller theller at python.net
Tue May 24 11:16:54 EDT 2005


Tim Golden schrieb:
> | Hello All.
> |   I'm trying to 'compile-to-EXE' a python program which uses 
> | Win32 & WMI to
> | pull system info. from the PC such as serial number, CPU 
> | speed, etc.  I'm
> | having problems with py2exe -- with regard to Win2000 & WinXP 
> | platforms.  It
> | seems that the program only works if I have one typelib for 
> | WinXP and a
> | slightly different one for Win2000.  Here is my relevent 
> | section from the
> | py2exe setup.py:
> 
> [... snipped ...]
> 
> | Can anyone tell me how I might make one unified py2exe 
> | setup.py that'll
> | 'compile' for both Win2000 & WinXP?
> | 
> | If not, can someone give me a hint as to how I can have a 
> | python 'launcher'
> | which can determine the difference between Win2000 & WinXP?  Using the
> | sys.platform, they both show as Win32.
> | 
> | Thanks!
> | Dave
> 
> There was a thread about this on the python-win32 list a 
> while back. I think this is the start of the the thread
> (altho' it's a bit confusing). The conclusion seems to
> be that there's no conclusion. Maybe there's more info
> on the py2exe list/wiki?
> 
> http://aspn.activestate.com/ASPN/Mail/Message/Python-win32/2007557
> 
I don't think something wnet into the wiki, unfortunately.
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
- change win32com so that the typelib wrappers can be generated by 
frozen executables at runtime.

Thomas



More information about the Python-list mailing list