Problem: Windows Command line Pipe to stdin
Python 2.3 on Windows XP
The following works when run from the command line.
import sys
text = sys.stdin.read()
# do something on the text
# ...
sys.stdout.write(text)
But if the above code is used as a filter program that gets another programs
output as shown below, it fails as shown.
C:\>textGen.py | filter.py
Traceback (most recent call last):
File "C:\filter.py", line 4, in ?
text = sys.stdin.read()
IOError: [Errno 9] Bad file descriptor
Any ideas on what is happening and how to fix it?
.
Relevant Pages
- Re: How do I remove XP Pro setup at boot?
... Just do sys c: If the command runs successfully you will get a message saying something to the effect that system files have been transfered to the disk. ... I made the boot disk ages ago, and the FDISK.EXE and I think the sys utilities are also there. ... Windows will not now open with or without the floppy. ... (microsoft.public.windowsxp.general) - Re: How do I remove XP Pro setup at boot?
... I can see FDISK.EXE but not a sys command file. ... I made the boot disk ages ago, and the FDISK.EXE and I think the sys ... Windows will not now open with or without the floppy. ... (microsoft.public.windowsxp.general) - Re: How do I remove XP Pro setup at boot?
... will have to execute the file that you download to create the diskette) and try running the sys command again. ... I made the boot disk ages ago, and the FDISK.EXE and I think the sys utilities are also there. ... Windows will not now open with or without the floppy. ... (microsoft.public.windowsxp.general) - Re: Bill Gates and Linux hatred (obligatory SCO link)
... >> So the dir command ran to completion BEFORE the filter program was run. ... Which DOS? ... Caldera OpenDOS is multitasking. ... (alt.os.linux) - Re: Bill Gates and Linux hatred (obligatory SCO link)
... > So the dir command ran to completion BEFORE the filter program was run. ... John Hasler ... Dancing Horse Hill ... (alt.os.linux) |
|