Piping data into script under Win32

Jaime Wyant programmer.py at gmail.com
Fri Apr 15 22:23:32 EDT 2005


I can't think of any reason that wouldn't work.  You've entered the
code in exactly like you have it below?

Could you paste the traceback from your console?

jw

On 15 Apr 2005 19:11:44 -0700, runes <rune.strand at gmail.com> wrote:
> 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.readlines()
> 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>
> 
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list