Python subprocess.Popen() wait for completion

subprocess.check_output( ... )

will block ... and can be used instead of Popen

however if you are set on Popen

subprocess.Popen(...).communicate() 

will also block until the process returns


Use Popen.wait:

process = subprocess.Popen(["your_cmd"]...)
process.wait()

Or check_output, check_call which all wait for the return code depending on what you want to do and the version of python.

If you are using python >= 2.7 and you don't care about the output just use check_call.

You can also use call but that will not raise any error if you have a non-zero return code which may or may not be desirable