About wmi
patrol
sunp1028 at gmail.com
Wed Jul 16 11:54:02 EDT 2008
On 7月16日, 下午10时39分, Tim Golden <m... at timgolden.me.uk> wrote:
> 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
-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
More information about the Python-list
mailing list