[Twisted-Python] PB and multiple apps
grimmtooth at softhome.net
Thu Feb 13 17:37:57 EST 2003
I may get an answer from the docs eventually, but I've encountered a bit
of difficulty with pb.
I have two apps (and thus two event loops) that operate independently
but can talk to each other through PB. I *am* using different port
numbers for the two, just to be safe.
This initially works great, but I have encountered what seems to be a
namespace issue. I'm using the example code given for PB in the how-to,
which employs functions at the top level of the script. I am using this
chunk of code as a library -- i.e. each app imports this bit of code and
uses it to communicate with the other.
Occasionally, one of the apps using PB in this way is forcing the other
app to shut down. I've traced this to the reactor.stop() line in each
of the pb callbacks on the client side.
I've considered a few approaches, but if anyone has any sage advice it
would be greatly appreciated :-)
1) Limit scope of imports as much as possible to reduce conflicts a bit.
2) find a way to gracefully inject my PB client calls into the existing
event loop without having to call reactore.run() / reactor.stop() in my
library module. (favored at the moment)
3) keep reading PB docs and maybe find a wrinkle I wasn't aware of yet.
Thanks in advance...
More information about the Twisted-Python