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?

4

1 に答える 1

0

あはは!したがって、答えは実行することです:

pyro_proxy._pyroGetMetadata()

リモート オブジェクトに関するメタデータを取得し、Pyro4.Proxyオブジェクトのメソッドを埋めます。

リンク:

于 2015-11-19T11:56:23.157 に答える