Object passing in rpyc is not performed

I am trying to pass an object as a parameter using RPyC from client to server. But the server cannot access the object, and I get the AttributeError attribute.

Server Code:

class AgentService(rpyc.Service):
  def exposed_func(self, obj):
    return obj.name

Client code

self._conn = connect(agent_host, agent_port, config = {"allow_public_attrs" : True})
return self._conn.root.func(obj)

returns: AttributeError: cannot access 'name'.

I use RPyC services and subscribing to the website should work.

Any ideas?

+5
source share
1 answer

The dict configuration must be configured on the client side and on the server side.

allow_public_attrs : True, allow_all_attrs : True, (.. , "_" ).

, :

server = ThreadedServer(MyService, port = 12345,
                        protocol_config = {"allow_public_attrs" : True})

.

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

+5

All Articles