Bi-directional communication with external programs?

Norbert Nemec at NOSPAM.COM
Tue Jun 3 14:50:13 CEST 2003

Hi there,

can anybody help me on this: I want to communicate bidirectionally with a
gnuplot session I spawned from python.

* popen3 for input/output/stderr
* write one command
* read and evaluate result
* write next command
* read and evaluate result

Problem: file.readline does block if there is nothing to read and select()
does not seem to do anything useful either (it always tells me that there
is data to read, even though there is none.)

Unfortunately, I cannot predict in advance how much to read, as
errormessages and other data comes through the same pipe and have to be
discarded somehow.

Anybody out there who can help me on that?


More information about the Python-list mailing list