[IPython-User] Python + twisted
Sun Jan 16 20:55:08 CST 2011
On Fri, Jan 14, 2011 at 1:33 AM, Alessandro Dentella <firstname.lastname@example.org> wrote:
> Thanks Brian for the good hint!
> On Wed, Jan 12, 2011 at 10:54:08AM -0800, Brian Granger wrote:
>> > 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 
>> > by Metthew Scott and a comment by Bob Ippolito on that recepe that suggests
>> > a different approch .
>> > 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
> It's for a client of a serial bus, answers tipical delay is below 1 second.
> It's a program that interacts with a domotic system where electric modules
> are switches and I would like to interact to switch the on/off and do other
> pretty simple operations.
> My goal is to handle an object (e.g.: ElecticSchema) where I can
> tab-complete on existing modules, where I can tab-complete on single exits.
>> clients, I would start the Twisted event loop in a thread and then use
>> Twisted's blockingCallFromThread to make Twisted using calls.
> I see that IPython.kernel.twistedutil has ReactorInThread, and the docstring suggests:
> rit = ReactorInThread()
> that's all I needed to get to my first working prototipe. Thanks a lot!
> This really solves my need, just for completeness the next question.
Nice, glad this helped. This is what I would do for a client-like situation.
> On the twisted ml i ws suggested to test twisted.manhole.telnet. I could get
> to a nice different approach that allows me to get to a running reactor via
> telnet. The only problem is that I was not able to enable tab-completion at
> that level. Is it possible to start an IPython shell from manhole?
Not with IPython's current design and that probably won't change.
> Thanks again
> Sandro Dentella *:-)
> http://www.reteisi.org Soluzioni libere per le scuole
> http://sqlkit.argolinux.org SQLkit home page - PyGTK/python/sqlalchemy
Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
More information about the IPython-User