[IPython-User] Python + twisted

Brian Granger ellisonbg@gmail....
Wed Jan 12 12:54:08 CST 2011


> I'm starting a project where I plan to use twisted for the first time. I'd
> like to practice using ipython and after looking around I found a recepe [1]
> by Metthew Scott and a comment by Bob Ippolito on that recepe that suggests
> a different approch [2].
> In the ipython manual there's a reference to twisted in the -*thread
> section, but it's unclear to me what should be the option (-pylab as for
> matplotlib?):
> -gthread, -qthread, -q4thread, -wthread, -pylab
>    Only  ONE  of  these  can  be given, and it can only be given as the first option
>    passed to IPython (it will have no effect in any other position).   They  provide
>    threading  support  for  the  GTK,  QT3, QT4 and WXWidgets toolkits, for the mat-
>    plotlib library and Twisted reactor.
> So what's the suggested way to play with twisted from ipython?

It depends on whether this is for a server or client type thingy.  For
clients, I would start the Twisted event loop in a thread and then use
Twisted's blockingCallFromThread to make Twisted using calls.

Other than that, there is not much you can do that is thread safe and reliable.



> thanks in advance
> sandro
> *:-)
> [1] http://code.activestate.com/recipes/410670-integrating-twisted-reactor-with-ipython/
> [2] http://bob.pythonmac.org/archives/2005/04/17/twisted-and-foreign-event-loops/
> --
> Sandro Dentella  *:-)
> http://www.reteisi.org             Soluzioni libere per le scuole
> http://sqlkit.argolinux.org        SQLkit home page - PyGTK/python/sqlalchemy
> _______________________________________________
> IPython-User mailing list
> IPython-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-user

Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo

More information about the IPython-User mailing list