[IPython-dev] Redirecting ipython in and out

Fernando Perez Fernando.Perez at colorado.edu
Tue Jun 28 12:12:48 EDT 2005

Frédéric Mantegazza wrote:
> Hello Fernando,
> I would like to know if it is possible to redirect ipython stdin and 
> stdout ? Here is what I would be able to do:
> You remember that our application embedds a ipython instance as a user 
> input/output console. As it is a client connected to a server, we can 
> launch several ipython instances. When a command is sent, the result is 
> printed by a Pyro mecanism called Event Server on all connected clients. 
> This is fine because they can see what is executed by others.
> But I would like to go further: I would also like to see what other clients 
> *send* to the server. I mean that when a client enter the command:
> In [15]: A1.drive(10)
> after the return key is pressed all clients should print :
> In [xx]: A1.drive(10)
> But the command should be executed only on the ipython instance where user 
> entered it. Others should act as passive displays.
> Do you think this is possible ? Is there a hook to do this, or do I have to 
> hack a little bit the code ?

No, unfortunately there's no simple way to do this at the moment.  While I've 
tried to clean up stdin/out assumptions in ipython, this is one of the major 
stumbling blocks preventing it from being easily embeddable in a GUI shell. 
It still makes too many assumptions about stdin/out being the default ones, 
connected to a TTY.

But there may be light at the end of the tunnel: since I can never find enough 
time for deep ipython work, I went the google route and got lucky.  Two 
students will be working this summer on the ipython/notebooks project, and one 
of them specifically proposed to work on the GUI aspects.  This will 
inevitably require finishing up the stdin/out abstraction work, so if this 
effort is successful, we'll have fairly significant improvements by summer's 

Let's wait and see how it all unfolds...



More information about the IPython-dev mailing list