java - how to use pyro to call python with object as parameter -


i have setup small test java application calls python script after starting pyro server (in python). works great except want pass python class object parameter method. exception python side saying:

pyro4.errors.serializeerror: unsupported serialized class:  com.test.pyro4.testlog   

according pyros documentation class converted dict in python can't far.

java code:

nameserverproxy ns = nameserverproxy.locatens("localhost"); pyroproxy remotepluginobject = new pyroproxy(ns.lookup("plugin"));  int length = 5; double[] values = new double[] { 0.5, 0.3, 0.6, 05, 0.4 }; double = 6.94; double b = 2.17;  remoteobject = new pyroproxy(ns.lookup("test.object")); remoteobject.call("setvalues", values, length);  object result = remoteobject.call("calculate", remoteobject, a, b);  system.out.println(result.tostring());  remotepluginobject.close();              remoteobject.close(); ns.close(); 

python server code:

class testobject(object): values=[] length=0  def setvalues(self, valuesarray, lengthvalue):     values=valuesarray     length=lengthvalue      class plugin(object): def calculate(self, obj, a, b):     result = example.calculate(obj, a, b)     return result  plugin=plugin() obj=testobject()  daemon=pyro4.daemon() ns=pyro4.locatens()  pluginuri=daemon.register(plugin) ns.register("plugin", pluginuri)  objuri=daemon.register(obj) ns.register("test.object", objuri)  daemon.requestloop() 

try setting serializer pickle:

pyro4.config.serializer = 'pickle' 

be aware has security implications.

and in java:

config.serializer = config.serializertype.pickle;  

Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -