[IPython-dev] ipython with twisted reactor
Min RK
benjaminrk at gmail.com
Fri Mar 1 13:16:10 EST 2013
I don't know what the waker function would be, but the event loop IPython uses is tornado,
So that's what twisted needs to work with.
-MinRK
On Mar 1, 2013, at 8:37, tcb <thecolourblue+m at gmail.com> wrote:
> Hi,
>
> 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:
>
> threading.Thread(target=reactor.run, kwargs={'installSignalHandlers':False}).start()
>
> 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 loops:
>
> from twisted.internet import reactor
>
> reactor.interleave(foreignEventLoopWakerFunction)
>
> but I have no idea which ipython function would serve as a 'waker' function.
>
> Has anyone managed to do this already in the notebook?
>
> -thanks
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20130301/fa41ee58/attachment.html>
More information about the IPython-dev
mailing list