what does "python -i" use as input stream (stdin)?

Almar Klein almar.klein at gmail.com
Thu Oct 2 10:29:30 CEST 2008

> I did not understand completely what you want, and rereading previous posts
> I got even more confused...
> Could you provide a complete description of what you want to do?
> Is it a single process, or two separate processes? Running on the same
> machine or remotely? All python or there is another program involved?

Hehe, sory for that...
I have two seperate processes on the same (windows) machine,
which are both python. One is a wx GUI (a simple IDE), and the
other should function as a python interpreter. The latter is a
subprocess of the former, created using wx.Execute / wx.Process,
and there are three pipes between the two.

I wanted to start the interpreter process as
"python -i my_startup_script.py".
In the startup script I create a "connection thread" that reads the
original standard input (a pipe to the wx GUI), and will most of the
time write the read-result to a pseudofile.

(In this setup, I can do special requests from the GUI, that the
"connection thread" will process, for example interrupt the main
thread or get introspection information.)

When python finishes processing my startup script, it goes into
"interpreter mode" because of the -i flag. What I want is that it
will use the pseudofile as it's stdin. The result should be a python
interpreter with some extra control, plus I am now able to "hijack"
the tk mainloop, and this way have interactive behaviour in matplotlib.

I hope it is more clear now... I wonder if this can be done, but it's no
big problem if it cannot; as I said before, I already have this setup
working with an interpreter inherited from code.InteractiveConsole.
Which means I do not use -i, but at the end of the startup script I
create an instance of that interpreter and call .interact().

Thanks again,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20081002/6d748b5e/attachment.html>

More information about the Python-list mailing list