1

I have a Python script "test1.py" with the following contents:

import sys

for line in sys.stdin:
        print line

When I call the script like this

type some_file.txt | ipy test1.py

All lines of "some_file.txt" are printed to the console (as expected). However, my problem is that the script does not return. It looks like EOF is not detected and therefore the stdin.read() method is blocking the script.

When I run the script with CPython

type some_file.txt | python test1.py

everything works as expected (i.e. the script terminates after the last line was printed).

To me this looks like a bug in IronPython (I have tested with v2.7.4 and v2.7.5). Can someone confrim this? Is there a good workaround?

Krid
  • 95
  • 1
  • 11

0 Answers0