Having trouble handling events

Tom Hanson <[email protected]> Mon, 3 Mar 2014 16:41:04 +0000
Newsgroups gmane.comp.python.pyro
Message-ID <CAAv+OaZfOh8v_b_uvKWTC55SdrcapvejOyWKJJ273CAv_pkY3w@mail.gmail.com>
Hey everyone!

I'm trying to add Pyro4 events to my gobject MainLoop, but I'm having
trouble with handling them.

This is some of some code that I've tried:

def start_pyro(self,device_id):
    """Sets up Pyro, sharing Slave, and starting the eventloop"""
    def handle_pyro(self, socket,*args):
      daemon.events(socket)
      return True

    slave = Slave()

    daemon=Pyro4.Daemon()
    ns=Pyro4.locateNS()
    uri=daemon.register(slave)
    ns.register("pisync.slave.%s" % device_id, uri)

    gobject.io_add_watch(daemon.sockets[0],gobject.IO_IN,handle_pyro)
    gobject.MainLoop().run()

It seems to run fine, but when I try to access the object remotely the
remote device just hangs and the local device displays:

Traceback (most recent call last):
  File "modules/pyro_slave_new.py", line 83, in handle_pyro
    print daemon.events([socket])
  File "/usr/local/lib/python2.7/dist-packages/Pyro4/core.py", line 658, in
events
    return self.transportServer.events(eventsockets)
  File
"/usr/local/lib/python2.7/dist-packages/Pyro4/socketserver/threadpoolserver.py",
line 133, in events
    assert self.sock in eventsockets
AssertionError

Could anyone point me to where I'm going wrong?

Thanks!
Tom Hanson

------------------------------------------------------------------------------
Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk

_______________________________________________
Pyro-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyro-core