child = subprocess.Popen(command,
subout = ""
for line in iter(child.stdout.readline, b''):
subout += line
rc = child.wait()
You're likely hitting the deadlock that's explained in the documentation:
Wait for child process to terminate. Set and return
Warning: This will deadlock when using
stderr=PIPEand the child process generates enough output to a pipe such that it blocks waiting for the OS pipe buffer to accept more data. Use
communicate()to avoid that.
The solution is to use