[IPython-dev] Twisted reactor + IPython0

Glenn H Tarbox, PhD glenn@tarbox....
Thu Mar 20 00:41:18 CDT 2008


On Thu, 2008-03-20 at 07:33 +0200, Ville M. Vainio wrote:
> On Thu, Mar 20, 2008 at 12:35 AM, Glenn H Tarbox, PhD <glenn@tarbox.org> wrote:
> 
> > This is where I started originally.  There's a better fix which I posted
> >  a while ago.  The below uses polling which is unnecessary.  By modifying
> >  shell, you can turn the whole thing into a callback.
> 
> The ASPN recipe works like the current GUI backends, so it seems to
> "obviously work".

it works, just spins cycles unnecessarily.  If you look through this
list you'll see the minor changes I made to Shell (posted on Feb 9).  My
code generates a callback when somethings needs to be serviced as
opposed to having a high-frequency polling loop try and determine the
same thing

> 
> >
> >  A better approach is to use my qtreactor (it sucks in qt but) because
> >  you can instantiate twisted (and qt) and keep the event loop for
> >  stdin/stdout and have reactor behavior as well.
> 
> Would that work with other backends as well? Does it work with windows
> + pyreadline?

yup

> 
> >  the key with qtreactor is I made a new call = reactor.runReturn() which
> >  nails up the reactor to the Qt application, sets up the timers etc, but
> >  returns the thread to you... so as long as I/O in IPython doesn't block
> >  (which it only does when scrolling more than a page)
> 
> That's a pretty fine solution, if it can be made to work.
> 
> Can you produce a code snippet that does this for IPython0?

was already posted before you wrote this.

> 
-- 
Glenn H. Tarbox, PhD
206-494-0819
glenn@tarbox.org



More information about the IPython-dev mailing list