[IPython-dev] ipython1 and synchronous printing of stdout

Gael Varoquaux gael.varoquaux@normalesup....
Fri Aug 8 15:24:39 CDT 2008


On Fri, Aug 08, 2008 at 10:18:49PM +0200, Hans Meine wrote:
> >   * I execute sub-processes with anonimous-pipes as their stdin/stdout
> >     and use a separate thread to empty these pipes onto the screen
> >     without blocking.

> Hmm - since I did not write a frontend to ipython with its "!" facility, I am 
> not sure I ever tried this.  Wouldn't the filedescriptor-method also work for 
> os.system/subprocess.calls?

Hum, not really, it is cleaner to use pipe, as it allows to make sure
that stdin is in sync with stdout and stderr. That was _hard_ by the way.

> > I am anyhow interested in your ideas for that, do mind posting the link
> > to the discussion you refer to? My google foo doesn't seem to be
> > good-enough to find it.

> To be honest - if I knew how to find it again, I would have sent the link in 
> the first place.

> After some digging, I finally found it, it was in the "Changes to Notebook 
> Format" thread, and it turns out that Robert Kern actually was the one who 
> came up with the working solution.  I only later send his code (with 
> attribution) to C++-Sig, when the question was discussed there, too.
> http://mlblog.osdir.com/python.ipython.devel/2005-08/

OK, I use this, but this by itself is not sufficient, because you want to
have trap to shell back out in the GUI mainloop to refresh the screen and
process events like "Ctrl-C" every once in a while (once again,
multi-threading is unacceptable, because the GUI toolkits that we have
are not thread-safe (none is), and it would lead to crashers when the
users would input code that interacted with the GUI toolkit. I have to
build an event-driven design, but not a multithreaded design.

OK, back to doc-string writing, and test-writing.

Gaël


More information about the IPython-dev mailing list