Quoth Norbert Nemec <nobbi_at_theorie3.physik.uni-erlangen.de at NOSPAM.COM>:
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?
Maybe, but if it were so simple, there would be a more neatly packaged
solution and you would be using it already. Since you have a lot of
rather general issues, maybe more than you realize, and no specific
code, maybe it would be worth your time to search Google's comp.lang.python
archive for information about popen, popen3, pipes etc. Bidirectional
I/O is harder than one would think. Pay attention to anything you read
about buffered I/O.

Donn Cave, donn at u.washington.edu

Search Discussions

Discussion Posts


Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 4 of 4 | next ›
Discussion Overview
grouppython-list @
postedJun 3, '03 at 12:50p
activeJun 3, '03 at 6:12p



site design / logo © 2022 Grokbase