Python Popen().stdout.read() hang
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