My python script uses subprocess to call a linux utility that is very noisy. I want to store all of the output to a log file and show some of it to the user. I thought the
You want to pass these extra parameters to subprocess.Popen:
subprocess.Popen
bufsize=1, universal_newlines=True
Then you can iterate as in your example. (Tested with Python 3.5)