About wmi

patrol sunp1028 at gmail.com
Wed Jul 16 08:28:54 EDT 2008


On 7月16日, 下午3时29分, Tim Golden <m... at timgolden.me.uk> wrote:
> patrol wrote:
> >>http://timgolden.me.uk/wmi-project/wmi.py
>
> > It cannot work either.
>
> Oh well. It was only a quick fix! I'll try
> to get some kind of non-ASCII edition of Windows
> to test against. As I understand it, the situation
> is that some WMI exception (ie coming from the
> underlying WMI/COM subsystem) results in an error
> message which contains non-ASCII characters.
>
> Just so I'm not chasing red herrings, could you
> paste the output from the following code, please?
>
> <code>
> import wmi # use the version linked above
>
> c = wmi.WMI ("non-existent computer")
>
> #
> # Should give a traceback here for the DCOM
> # error, not a UnicodeDecodeError.
> #
> </code>
>
> Thanks
>
> TJG
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)

Patrol



More information about the Python-list mailing list