Use fileinput.input () to Read From stdin in Python. We can use the fileinput module to read from stdin in Python. fileinput.input () reads through all the lines in the input file names specified in command-line arguments. If no argument is specified, it will read the standard input provided. How to Read from stdin in Python – JournalDev New . 2. Support for connecting several subprocesses (shell “pipe”). Universal newline support. A communicate() method, which makes it easy to send stdin data and read stdout and stderr data, without risking deadlocks. Most people are aware of the flow control issues involved with child process communication, but not all have the patience or skills. start the subprocess, using output_pipe as the output pipe and an internal pipe as stdin keep polling for the end of the child process try and open input_pipe write to the child’s stdin what you read from the pipe in code this looks like:. Removing the python script from the end produces real-time awk formatted data without delay. I've also tried this for the script so that I'm only reading a single character at a time, same problem: Expand | Select | Wrap | Line Numbers. import sys. buffer =  while 1: char = sys.stdin.read (1) if not char == "\n": buffer.append (char).