[py] | Sent: 30 December 2005 16:15 | To: python-list@python.org | Subject: Re: WMI - invalid syntax error? | | py wrote: | >Something must be happening somewhere causing it | > to get fouled up. I'm gonna try on a different PC. | | I tried on another PC, same problem. | | Also, I added "reload(wmi)" before I create an instance of | wmi.WMI just | to see what happens, so I hve... | | import wmi | | def ppn(machine=None): | try: | reload(wmi) | wmiObj = wmi.WMI(machine) | except Exception, e: | print "Error: " + str(e) | | ...now I get this as the error message.. | Error: (-2147221020, 'Invalid syntax', None, None) | | Slightly different than before...but same message.
Hmmm. I think I'm now in the unusual situation of having *too much* information to solve the problem. The thing I'm straining for is the minimum reproducible situation. At first it looked as though it was down to running the code from a file rather than at the interpreter. Is that still the case? Your previous post about the monikers suggests that running the code twice -- in any way -- triggered the problem. Is that true? The code above introduces the extra complication of a reload which I'm afraid just muddies the waters. To confirm, your code above runs from a file any number of times without issue on my (WinXP Python 2.4.2) box using wmi 0.6b. Behind the scenes, the wmi module is doing something like this: <code> import win32com.client x = win32com.client.GetObject ("winmgmts:") </code> Now if I deliberately fudge that moniker, I'll get the error message you show above, which is what I expected with an ill-formed moniker. <code> import win32com.client x = win32com.client.GetObject ("winmgmtxx:") # pywintypes.com_error: (-2147221020, 'Invalid syntax', None, None) </code> Googling for your original error code (-0x7ffbfe1c) which is 800401E4 in top-bit-set hex, most of the hits suggest that WMI is not installed on the box in question (typically because it's a Win98 or WinNT install without the WMI download). But you're on WinXP, so that can't be it. I'm afraid I'm still mystified; it's frustrating because I can't even reproduce the situation. 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 ________________________________________________________________________ -- http://mail.python.org/mailman/listinfo/python-list