Re: Cannot return object copies (autoproxy off)
Irmen de Jong <[email protected]> Sun, 15 Jun 2014 12:34:41 +0200
| Newsgroups | gmane.comp.python.pyro |
|---|---|
| Message-ID | <[email protected]> |
On 14-6-2014 20:57, Plamen Dimitrov wrote: > I followed the most basic example to register an object and according to the > documentation if I turn off the autoproxy option (of course it would be better on, but I > cannot modify the original code I am trying to distribute over the network), I should > receive a copy of the remotely constructed object. However, all I get is > > ProtocolError: unsupported serialized class: ... Please give the full error and stacktrace. That is more or less essential to track down problems. > which is not really true because I have already remotely accessed different instances of > the same class (!). In a more illustrative example: Well, I think you trust Python? It is telling you the truth here: you are asking it to deserialize something that it doesn't recognize. If this error didn't occur earlier, you changed something that changed the objects being sent across the wire. > I want to share an instance of Dog where remotely calling its method bark(), I get back > an instance of Sound. I have registered the Dog instance and when I call bark(), I get > the above error. You are trying to send a Sound instance across the wire. The default serializer (serpent) doesn't support custom classes unless you teach it. (look up register_class_to_dict and register_dict_to_class) > In a different case I have remotely called a method of Sound and had no > troubles serializing the Sound instance and accessing it remotely. Do you have any ideas > what am I doing wrong? I think your understanding of what Pyro sends across the wire is slightly wrong. When you access an object remotely, nothing about that object travels over the wire. The only thing Pyro sends across is a *proxy* to that object. Which is naturally supported by all serializers. So when you set AUTOPROXY *on*, you'll get a proxy that can be serialized without error. When you set AUTOPROXY *off*, you'll asking for a copy of the object but that will probably not be supported by the serializer (unless you take some action). Irmen ------------------------------------------------------------------------------ HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing & Easy Data Exploration http://p.sf.net/sfu/hpccsystems