I trying to figure out a way to make a python script accept data output
from another process under Windows XP, but I fail miserably. I have a
vague memory having read this is not possible with Python under
Windows...
But googling for a clue I came across this from /Learning Python/ (Lutz
& Ascher) [1]
<Learning Python>
import sys
data = sys.stdin.readl ines()
print "Counted", len(data), "lines."
On Unix, you could test it by doing something like:
% cat countlines.py | python countlines.py
Counted 3 lines.
On Windows or DOS, you'd do:
C:\> type countlines.py | python countlines.py
Counted 3 lines.
</Learning Python>
So: Is it possible to pipe data under DOS/Win9x but not NT/2k/XP or is
it a bug in /Learning Python/ ?
I've tried about all kinds of sane and insane approaches involving
sys.stdin, but they all results in IOError: [Errno 9] Bad file
descriptor.
[1] <http://www.oreilly.com/catalog/lpython/chapter/ch09.html>