About wmi

Tim Golden mail at timgolden.me.uk
Wed Jul 16 10:39:29 EDT 2008


patrol wrote:
> The errors are in the following:
> 
> Traceback (most recent call last):
>   File "D:\My Documents\code\python\wmi\test.py", line 5, in <module>
>     c = wmi.WMI ("non-existent computer")
>   File "C:\Python25\lib\wmi.py", line 1199, in connect
>     handle_com_error (error_info)
>   File "C:\Python25\lib\wmi.py", line 184, in handle_com_error
>     exception_string = [u"%s - %s" % (hex (hresult_code),
> hresult_name)]
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xb7 in position
> 4: ordinal not in range(128)

OK, I'm trying to set up a Virtual PC so I can install
a non-English XP. But would you mind running the
following code for me, please, so I can get a handle
on what's coming back:

<code>
import pythoncom
import win32com.client

try:
  win32com.client.GetObject ("winmgmts://blahblah")
except pythoncom.com_error, info:
  for i in info:
    print repr (i)

</code>

Thanks
TJG



More information about the Python-list mailing list