[ python-Bugs-1012692 ] Can't pipe input to a python program

SourceForge.net noreply at sourceforge.net
Sat Aug 21 19:43:38 CEST 2004


Bugs item #1012692, was opened at 2004-08-20 00:31
Message generated for change (Comment added) made by rivest
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1012692&group_id=5470

Category: Windows
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Ronald L. Rivest (rivest)
Assigned to: Nobody/Anonymous (nobody)
Summary: Can't pipe input to a python program

Initial Comment:
Details in attached file.  Basically, I want to be 
able (in Windows) to pipe input as in:
    type spam.txt | eggs.py
so that eggs can read the file spam.txt.  But I am
getting an  Errno 9: Bad file descriptor error message.

Thanks.

        Cheers,
        Ron Rivest
        rivest at mit.edu 
 [Please reply to rivest at mit.edu as well...]

----------------------------------------------------------------------

>Comment By: Ronald L. Rivest (rivest)
Date: 2004-08-21 12:43

Message:
Logged In: YES 
user_id=1090045

If I print out sys.stdin.fileno(), I get  -1 .
Ver.exe outputs: Microsoft Windows XP [Version 5.1.2600]
This is indeed the standard command interpreter; I set the
prompt envinronment variable to output just ">".

Thanks...

        Ron Rivest



----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2004-08-21 10:09

Message:
Logged In: YES 
user_id=21627

What shell is this in? I cannot reproduce this in a cmd.exe
window. However, that you report the version as "Windows 5.1
(Build 2600)" and not "Microsoft Windows XP [Version
5.1.2600]" (as ver.exe does), and that you use just ">" as
the prompt suggests you might be using a different command
interpreter.

Can you please add

print sys.stdin.fileno()

into the script? On my system, it gives "0".

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1012692&group_id=5470


More information about the Python-bugs-list mailing list