I\'m trying to get output of another script, using Python\'s subprocess.Popen
like follows
process = Popen(command, stdout=PIPE, shell=True)
exitc
You probably want to use .communicate() rather than .wait()
plus .read()
. Note the warning about wait()
on the subprocess
documentation page:
Warning This will deadlock when using
stdout=PIPE
and/orstderr=PIPE
and the child process generates enough output to a pipe such that it blocks waiting for the OS pipe buffer to accept more data. Usecommunicate()
to avoid that.
http://docs.python.org/2/library/subprocess.html#subprocess.Popen.wait
You can see how to deal with hanging reading of stdout/stderr in the next sources:
readingproc
read() waits for EOF before returning.
You can: