I have a very long running process that I would like to call from a Python program. This process outputs a lot of information to stdout. I would like to see the output from my called program on the command line as it is running. I have read about Popen, and tried
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
stdout, stderr = p.communicate()
and variants of this, but the output from cmd doesn't get displayed until cmd is finished running.
How do I view the output of cmd while cmd is running?