Python subprocess.Popen() wait for completion [duplicate]

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

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)