[IPython-dev] ipython with twisted reactor

tcb thecolourblue+m@gmail....
Fri Mar 1 10:37:43 CST 2013


I am trying to use the ipython notebook with some example code which sets
up a websocket server (using autobahn python
http://autobahn.ws/python/tutorials/echo ).

The problem is that I need to call twisted's reactor.run() method, but this
blocks all input, and I need to interact with the objects to send/receive
messages. I haven't been able to get this to work in the notebook yet. I
assume its a problem interacting with the tornado eventloop in ipython- but
it could be something else (the examples work fine outside of ipython).

Rather than calling reactor.run()- I've tried putting it into a thread:


but that doesn't work either- it doesn't ever run.

The threadedselector doesn't seem to run either (putting this at the top of
my script):

from twisted.internet import _threadedselect
reactor = _threadedselect.install()

There is a possibility to interleave the twisted eventloop with other event

from twisted.internet import reactor


but I have no idea which ipython function would serve as a 'waker' function.

Has anyone managed to do this already in the notebook?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-dev/attachments/20130301/dd17e215/attachment.html 

More information about the IPython-dev mailing list