I have setup a small test java application that calls a python script after starting a pyro server (in python). It works great except now I want to pass the python class an object as a parameter to its method. I get an exception from the python side saying:
Pyro4.errors.SerializeError: unsupported serialized class:
com.test.pyro4.TestLog
According to pyros documentation a class will get converted to a dict in python but I can't even get that 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 a = 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()