I am writing to my Python process from the commandline on unix. I want to send EOF (or somehow flush the stdin buffer, so Python can read my input.)
If I hit CTRL-C, I get a KeyboardError.
If I hit CTRL-D, the program just stops.
How do I flush the stdin buffer?
If you use ‘for l in sys.stdin’, it is buffered.
You can use: