I\'ve problem to read from Standard input or pipe in python when the pipe is from a \"open\" (do not know right name) file.
I have as example pipetest.py:>
For this to work without waiting until the stdin stream ends, you can iter on the readline. I think this is the simplest solution.
import sys k = 0 try: for line in iter(sys.stdin.readline, b''): k = k + 1 print line except KeyboardInterrupt: sys.stdout.flush() pass print k