About wmi

Tim Golden mail at timgolden.me.uk
Wed Jul 16 17:59:16 CEST 2008


patrol wrote:
> -2147023174
> 'RPC \xb7\xfe\xce\xf1\xc6\xf7\xb2\xbb\xbf\xc9\xd3\xc3\xa1\xa3'
> None
> None
> 
> ----------------------------------------------------------------------
> import pythoncom
> import win32com.client
> 
> 
> try:
>   win32com.client.GetObject ("winmgmts://blahblah")
> except pythoncom.com_error, info:
>   for i in info:
>     print i
> 
> -2147023174
> RPC 服务器不可用。
> None
> None
> -------------------------------------------------------------------------
>>>> a="RPC 服务器不可用。"
>>>> a
> 'RPC \xb7\xfe\xce\xf1\xc6\xf7\xb2\xbb\xbf\xc9\xd3\xc3\xa1\xa3'
> -------------------------------------------------------------------------
> Patrol

Brilliant. Thanks, Patrol. So the error message comes back
encoded. Can you confirm what your console encoding is,
please? The following script should confirm:

<code>
import os, sys

print sys.stdout.encoding
os.system ("chcp")

</code>

TJG



More information about the Python-list mailing list