Re: [rpyc] rpyc ctypes support

94 views
Skip to first unread message

Tomer Filiba

unread,
Apr 12, 2013, 7:13:27 AM4/12/13
to rpyc
i'm not sure how ctypes works, but it makes sense that it performs strict type checks so it detects netfefs and complains accordingly.
if this is the case, you'll have to execute the code remotely.

-----------------------------------------------------------------
    
Tomer Filiba 
tomerfiliba.com        


On Wed, Apr 10, 2013 at 12:23 PM, ostealth <oost...@gmail.com> wrote:
Hi
Having some problems with RPyC and ctypes

Local machine python 2.7.3 RPyC 3.2.3
Remote  machine python 2.7.4 RPyC 3.2.3

from ctypes import *
import rpyc

conn = rpyc.classic.connect(remoteHost)
niWlan = conn.modules.ctypes.WinDLL(wlanDll)
sessionName = c_char_p('WLANG')
compatibilityVersion = c_int(30000)
newSession = c_int(0)
niWlan.niWLANG_OpenSession(sessionName,
                             compatibilityVersion,
                             byref(wlanSession),
                             byref(newSession))

Gives
Traceback (most recent call last):
  File "wlanRx.py", line 477, in <module>
    main()
  File "wlanRx.py", line 469, in main
    configureToolkitSession(niWlan)
  File "alexandros\wlanRx.py", line 259, in configureToolkitSession
    byref(newSession))
  File "C:\Python27\lib\site-packages\rpyc\core\netref.py", line 196, in __call__
    return syncreq(_self, consts.HANDLE_CALL, args, kwargs)
  File "C:\Python27\lib\site-packages\rpyc\core\netref.py", line 71, in syncreq
    return conn.sync_request(handler, oid, *args)
  File "C:\Python27\lib\site-packages\rpyc\core\protocol.py", line 438, in sync_request
    raise obj
ctypes.ArgumentError: argument 1: <type 'exceptions.TypeError'>: Don't know how to convert parameter 1

========= Remote Traceback (1) =========
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\rpyc\core\protocol.py", line 300, in _dispatch_request
    res = self._HANDLERS[handler](self, *args)
  File "C:\Python27\lib\site-packages\rpyc\core\protocol.py", line 532, in _handle_call
    return self._local_objects[oid](*args, **dict(kwargs))
ArgumentError: argument 1: <type 'exceptions.TypeError'>: Don't know how to convert parameter 1


Executing the same thing inside
conn.execute(sampleTxt)
with rpyc.classic.redirected_stdio(conn):
  conn.namespace['sample']()

It works nicely

Does RPyC have support for c_char_p, c_int, byref, pointer and the whole ctypes stuff?
Thanks


--
 
---
You received this message because you are subscribed to the Google Groups "rpyc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rpyc+uns...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages