On Mar 7, 12:23 pm, Fruch <[email protected]> wrote:
> https://github.com/fruch/rpyc
> we should do the same for ironpython
>
> Fruch

I updated my fork to the last changes:
https://github.com/delattj/rpyc

And I already made a fix as I only tested the server side, I took the
time to do the client side. And I find the same issue that with the
_make_method and class_factory name argument that get passed as
unicode.
I changed the _access_attr method and did a similar trick.

It all went well until I tried something more tricky.
I tried to do a rpyc.async on a rpyc proxy. Mainly to do Event ( see:
http://rpyc.wikidot.com/tutorial:part5 ).
It complains about proxy not being a callable. I checked if the
callable method works correctly under IronPython and as far as I can
tell it works just fine.
This scenario works under normal Python 2.6 distribution.
I'm kind of lost here.

I'm not sure how you want to discuss bugs from this mailing. Anyway
here the complete log:

Test Scenario:
Server runs service with Event callback subscription
Client A registers a Callback under Event 'foo' and run rpyc
BgServingThread
Client B triggers Event 'foo'

RESULT:
Client A recieve an error when registering its callback.

ERROR MESSAGE:
'proxy' must be callable
(full error log see below)

REPRO SCRIPTS:

####################### Server
import rpyc
from rpyc.utils.server import ThreadedServer
from rpyc.core import Service

class eventService(Service):
        events = {}
        def __init__(self, conn):
                Service.__init__(self, conn)
        def exposed_subscribe(self, name, callback):
                print "SUBS:", name, callback
                self.events[name] = rpyc.async(callback)
        def exposed_trigger(self, name, *args, **kwargs):
                print "TRIGGER:", name, "("+(name in self.events)+")"
                if name in self.events: self.events[name](*args, **kwargs)
                else: raise Exception("No event name: "+name)


t = ThreadedServer(eventService, port=22012, auto_register=False)
print "UP"
t.start()

####################### Client A
from rpyc.utils import factory
RPC = factory.connect("localhost", 22012)

def printValue(data):
        print data

RPC.root.subscribe('foo', printValue)

from rpyc import BgServingThread
eventListener = BgServingThread(RPC) #event listener

print "Ready"
from time import sleep
while 1: sleep(60)#wait forever

####################### Client B
from rpyc.utils import factory
RPC = factory.connect("localhost", 22012)

RPC.root.trigger('foo', 'Hello')



COMPLETE ERROR MESSAGE:
C:\Users\delattj\Desktop\RPYCtest\rpyc\core\vinegar.py:42:
DeprecationWar
ning: BaseException.message has been deprecated as of Python 2.6
  attrval = getattr(val, name)
======= Remote traceback =======
Traceback (most recent call last):
  File "C:\mtlgta\python\rpyc\core\protocol.py", line 227, in _d
ispatch_request
    res = self._HANDLERS[handler](self, *args)
  File "C:\mtlgta\python\rpyc\core\protocol.py", line 431, in _h
andle_call
    return self._local_objects[oid](*args, **dict(kwargs))
  File "testserver.py", line 12, in exposed_subscribe
    self.events[name] = rpyc.async(callback)
  File "C:\mtlgta\python\rpyc\utils\helpers.py", line 49, in asy
nc
    raise TypeError("'proxy' must be callable: %r" % (proxy,))
TypeError: 'proxy' must be callable: <function printValue at
0x0000000002C16358>


======= Local exception ========
Traceback (most recent call last):
  File "C:\Users\delattj\Desktop\RPYCtest\A.py", line 7, in <module>
    RPC.root.subscribe('foo', printValue)
  File "C:\Users\delattj\Desktop\RPYCtest\rpyc\core\netref.py", line
124,
 in __call__
    return syncreq(_self, consts.HANDLE_CALL, args, kwargs)
  File "C:\Users\delattj\Desktop\RPYCtest\rpyc\core\netref.py", line
45,
in syncreq
    return conn().sync_request(handler, oid, *args)
  File "C:\Users\delattj\Desktop\RPYCtest\rpyc\core\protocol.py", line
34
6, in sync_request
    raise obj
TypeError: 'proxy' must be callable: <function printValue at
0x0000000002C16358>

Reply via email to