patrol wrote:
>>>> import wmi
>>>> wmi.WMI('non-existent computer')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   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)
> --------------------------------------------------------------------------------------
> yup,error_info contains the Chinese encoded string. All of the Simple
> Chinese Windows use the CP936.Every Chinese word utilizes two
> bytes.Maybe you can fix this bug by modifying  handle_com_error.


Well, that's what I've done in that latest version.
Only I naively assumed
that I could use sys.stdout.encoding to determine
the encoding. I'll have to try harder.

TJG
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to