[python-win32] process creation ID returned as a string, not an int

Ray Pasco pascor at hotpop.com
Fri Oct 17 17:28:43 EDT 2003


After installing wmi on my Win98 box, I pulled my hair out for a while
trying to get the "Notepad" examples to work.  After a while I identified
the apparent and intermittent problem (bug?).  When creating a process
and saving the returned ID, sometime this value is an integer and sometimes
it is a string !  The only reliable way to end up with the integer value 
is to force it:

NotepadProcID, return_value = c.new ("Win32_Process").Create /
                                (CommandLine="notepad.exe")
# Absolutely necessary to *always* get a usable int !
NotepadProcID == int (str (NotepadProcID))    

I noticed that the integer version would be returned exactly once
immediately after a boot;  subsequent calls return the string equivalent.

Would anyone care to comment ?







More information about the Python-win32 mailing list