Howto? popen4("python -u") redirected to a gui window

André andre.roberge at
Fri Jan 27 19:25:07 EST 2006

Short description: Using a wxPython based app, I would like to take a
python script in an editor window, invoke the python interpreter and
use another window as stdin/stdout/stderr.

Based on what I've read so far, I've figured that I need to do
something like:
f_in, f_out = popen4("python -u")
where I have extracted the text from the editor and put it in
"".  (However, see below).

What I don't understand is how to link f_in, f_out somehow to a
different window which can be used to interact with the user.

I need a solution that will work on *nix, Windows and MacOS.

Although I am not familar with Tkinter, I most likely could figure out
what to do from an example that would use it.

Wish#1: It would be nice not to have to create the intermediate file
"" and pass directly the content of the editor window to
popen4().   I know about the "-c" option for Python, but I can't see
how it would work if the script contains quotes or double quotes.

Wish#2: It would be *really nice* if, somehow, request for input [which
should arise only from raw_input() ... and, perhaps input()] by Python
could be redirected to an appropriate wxPython dialog instead of just a
window.  I might be able to figure that one on my own, if I can get
enough information to get the basic redirection to a window working.


More information about the Python-list mailing list