Python2.3 and win32all wmi problems.

Tim Golden tim.golden at viacom-outdoor.co.uk
Wed Jun 4 09:03:52 EDT 2003


murtaza_hakim at yahoo.com (Murtaza Hakim) wrote

MH> when I try to access the Windows Management
MH> Instrumentation (WMI) classes I get a traceback.  
MH> This operation works fine using Python 2.2.

[ snip traceback ]

Just to clarify, I believe it is the version of win32all 
 which you are using, and not the version of Python, which
 is the source of the error. I get the same error running
 win32all-153 under Python 2.2.2.

However... because root/cimv2 is the default namespace for
 winmgmts queries, you seem to be able to get away with:

  GetObject ("winmgmts:")

or

  GetObject ("winmgmts://hostname")

or even

  GetObject ("winmgmts:{impersonationLevel=Impersonate}//hostname")

if you want.

BTW, I've just developed a mini-module to ease using WMI under Python.
 All it does is to wrap the WMI calls in Python classes with a bit
 of getattr / setattr magic. If you're interested, drop me a line.

Tim Golden




More information about the Python-list mailing list