stdio EOF ?
jacek.generowicz at cern.ch
Fri Aug 9 17:15:33 CEST 2002
I'm trying to write a filter (between the GNU plotutils ode and
graph). The problem I have is making it work in a situation like this:
cat | filter.py | whatever
(ode -f foo | filter.py | graph ... in reality)
The desired behaviour is that I should be able to type instructions
into standard input (which ode reacts to, sending data down the
pipeline) which the filter should process and pass on down the
pipeline without waiting ... but should stop when I send EOF.
Using "for line is stdin: ..." works if all the commands are in a file
and I do
cat command_file | filter.py | etc
but in the "cat | filter.py" situation, it doesn't produce any output
until C-d is sent.
I guess I'm looking for a "while something(stdin)" or "while
stdin.something" construct ...
Any ideas ?
More information about the Python-list