I have a python module like this:
from subprocess import *
cmdline = 'python example.py'
result = Popen(cmdline,shell=False,stdout=PIPE,stderr=PIPE,stdin=PIPE).stdout
I want the parent process to block until the child process finish executing and the parent process can receive the output of the child process. Will the code above serve my purpose? In my understanding, the child process will send its output to PIPE instead of STDOUT, and the parent process will block until the child process exits and the PIPE is closed. Can someone explain where I got misunderstood?
Another thing is either communicate or check_output returns a byte string, but I want to process the results line by line, is there a good way to do it?