I think I got it... 

Had to add 
slave.modules.pythoncom.CoInitialize()

before calling wmi.WMI() 

On Tuesday, December 11, 2012 1:25:05 PM UTC+2, Assaf wrote:
>
> here's the script and console output:
>
>
> *Script*:
> [root@master-win ~]# cat /tmp/test_rpyc.py 
> import rpyc
> conn = rpyc.classic.connect("host123")
> c = conn.modules.wmi.WMI()
> print c.Win32_OperationSystem()[0].name
>
>
> *Console*:
> [root@master-win ~]# python /tmp/test_rpyc.py 
> ======= Remote traceback =======
> Traceback (most recent call last):
>   File 
> "C:\python\lib\site-packages\rpyc-3.2.2-py2.7.egg\rpyc\core\protocol.py", 
> line 300, in _dispatch_request
>     res = self._HANDLERS[handler](self, *args)
>   File 
> "C:\python\lib\site-packages\rpyc-3.2.2-py2.7.egg\rpyc\core\protocol.py", 
> line 532, in _handle_call
>     return self._local_objects[oid](*args, **dict(kwargs))
>   File "C:\python\lib\site-packages\wmi.py", line 1270, in connect
>     raise x_wmi_uninitialised_thread ("WMI returned a syntax error: you're 
> probably running inside a thread without first calling 
> pythoncom.CoInitialize[Ex]")
> x_wmi_uninitialised_thread: <x_wmi: WMI returned a syntax error: you're 
> probably running inside a thread without first calling 
> pythoncom.CoInitialize[Ex] (no underlying exception)>
>
> ======= Local exception ========
> Traceback (most recent call last):
>   File "/tmp/test_rpyc.py", line 3, in <module>
>     c = conn.modules.wmi.WMI()
>   File 
> "/var/tmp/python/lib/python2.7/site-packages/rpyc-3.2.2-py2.7.egg/rpyc/core/netref.py",
>  
> line 196, in __call__
>     return syncreq(_self, consts.HANDLE_CALL, args, kwargs)
>   File 
> "/var/tmp/python/lib/python2.7/site-packages/rpyc-3.2.2-py2.7.egg/rpyc/core/netref.py",
>  
> line 71, in syncreq
>     return conn.sync_request(handler, oid, *args)
>   File 
> "/var/tmp/python/lib/python2.7/site-packages/rpyc-3.2.2-py2.7.egg/rpyc/core/protocol.py",
>  
> line 438, in sync_request
>     raise obj
> rpyc.core.vinegar/wmi.x_wmi_uninitialised_thread
>
>

Reply via email to