Duplicate of this question. Vote to close.
Consider this at the windows commandline.
scriptA.py | scriptB.py
In scriptA.py:
sys.stdout.write( "hello" )
In scriptB.py:
print sys.stdin.read()
This generates the following error:
c:\> scriptA.py | scriptB.py
close failed: [Errno 22] Invalid argument
Traceback (most recent call last):
File "c:\scriptB.py", line 20, in <module>
print sys.stdin.read()
IOError: [Errno 9] Bad file descriptor
The "close failed" message seems to come from execution of scriptA.py.
It doesn't matter if I use sys.stdin.read(), sys.stdin.read(1), sys.stdin.readlines() etc etc.
What's wrong?
Duplicate of this question. Vote to close.