yes. you need to allow attribute access, it's disabled by default.
if you looked at the exception, it's AttributeError: cannot access 'keys'

see - http://rpyc.sourceforge.net/api/core_protocol.html

this has to be done on both client side and server side.
on the server:

ThreadedServer(MyService, protocol_config = {"allow_public_attrs" : True},
port = 18833).start()

on the client:
c = rpyc.connect('localhost', 18833, config = {"allow_public_attrs" : True})


-----------------------------------------------------------------

*Tomer Filiba*
tomerfiliba.com     <http://www.facebook.com/tomerfiliba>
<http://il.linkedin.com/in/tomerfiliba>



On Thu, Feb 2, 2012 at 16:15, Shivakumar GN <[email protected]> wrote:

> Dictionary object passed from client does not seem iterable on the
> server side. If a key is known then dict_name[key] succeeds.
> Is this expected behavior or a bug?
>
> My server:
> -----------------------
> import rpyc
> from rpyc.utils.server import ThreadedServer
>
> class MyService(rpyc.Service):
>    def exposed_check_list(self, param_list):
>        for item in param_list:
>            print 'check_list >', item
>
>    def exposed_check_dict(self, param_dict):
>        print 'check_dict >', param_dict[3]
>        print param_dict.keys()
>
> if __name__ == "__main__" :
>    ThreadedServer (MyService, port = 18812).start()
>
>
>
> Client:
> -----------------
> import rpyc
>
> plist = [ 1, 2, 3, 4 ]
> pdict = { 1:2, 3:4 }
>
> c = rpyc.connect('localhost', 18812)
>
> c.root.check_list(plist)    # Call succeeds
> c.root.check_dict(pdict)    # Causes exception
>
> best regards
> Shivakumar GN
>

Reply via email to