0

In an application I use a low level library and run it in a separate process. The connection to the process is done with Pyro4.

The library needs initialization before the work and release of resources after. Thus, I implement the State pattern to have both states nicely separated.

The library is embedded into an object (which is called by Pyro4.Daemon). It has initialization method, which does necessary procedures and changes the __class__ of the object to the "ready" one, which has all the methods to call the library.

However, Pyro4.Proxy does not see the object change its' methods after the initialization method is called. Though, if you look at the actual object (in a separate interpreter, running the Pyro4.Daemon in a thread) -- the __class__ does change and everything is fine there. The problem is on Pyro4.Proxy side.

So, is it possible to change the __class__ when working with Pyro4? Am I just doing something wrong?

PS

It seems Pyro4.Proxy grabs the methods of the remote object when you call it the first time. And then the methods are frozen. Could I "refresh" this procedure somehow, ask Proxy to check out the methods again?

xealits
  • 4,224
  • 4
  • 27
  • 36

1 Answers1

0

Aha! So the answer is to run:

pyro_proxy._pyroGetMetadata()

it grabs the metadata about the remote object and fills the methods of Pyro4.Proxy object.

Links:

xealits
  • 4,224
  • 4
  • 27
  • 36
  • You're linking to the documentation of the obsolete version 3 of Pyro. It is likely you meant to link to the Pyro4 docs instead, such as http://pythonhosted.org/Pyro4/clientcode.html?highlight=metadata#metadata-from-the-daemon – Irmen de Jong Nov 28 '15 at 10:49