COM problem .py versus .exe

Greg Miller greg_miller at nexpress.com
Wed Jun 29 08:20:36 EDT 2005


I put you code snippet into my code, running it from the desktop PC
gave me the following output ( I added a print statement ):

. . . winmgmts:
TTTTTTTTTTTTTTTTT i.Caption is  \\rocps00101\ROCPR001
TTTTTTTTTTTTTTTTT i.Caption is  \\ROCPS00101\ROCPR024
TTTTTTTTTTTTTTTTT i.Caption is  \\ROCPS00101\ROCPR070
TTTTTTTTTTTTTTTTT i.Caption is  \\rocps00101\ROCPR143

so that appears to work great, I took out the for i in
c.Win32_Printer.... statement, built the executable, but still get the
exact same error on the embedded PC.  It errors as soon as the import
wmib call is made, so it never gets to:

 wmi._DEBUG = 1
moniker = "winmgmts:"

c = wmi.WMI (moniker=moniker)

that you recommended.  I also copied my python24 directory from the
desktop PC to the embedded PC.  Then added the path variable for
Python.  I ran the win32com\client\makepy.py file using our target dll.
 That seemed to work okay.  I got the expected output.  That didn't
seem to make a difference to the executable, same error was generated.
WMIB.pyc is in the library.zip file that py2exe builds, so I know that
it is getting into the executable correctly.  I will check around to
see if the win32 calls you were referring to made it into the pywin32
package.  I'll also look at ctypes again, I had originally looked at
using ctypes but your wmi package simplified things so much.  Thanks
again for you help.




More information about the Python-list mailing list