I have a compiled program called program
that takes in 1 argument called 2phase_eff
. I would like to run this program from python but also be able to view its progress (it outputs various progress messages) on the shell in real time. So far I have succeeded in actually running it and viewing output after it is done running using the following code:
import subprocess
subprocess.Popen("program 2phase_eff", stdout=subprocess.PIPE, shell=True).communicate()
Yes this does output all the intermediate stuff at the very end but there are two problems
- I cannot see the
cmd
shell and - The output is not in real time
How can I tweak the above command to fulfill above two objectives? Thanks.