I would like to be able to call two (or more) commands within python but I would like to make sure that the first is finished before the second starts. Is that possible with subprocess? For example:
subprocess.call("script1 input1 > out", shell=True)
and when that command finishes:
subprocess.call("script2 out>out2", shell=True)
or is there a better way?
A call to
subprocess.callblocks until the command completes. From the documentation:A similar option that also waits for completion is
subprocess.check_call. The difference betweencallandcheck_callis that the latter raises an exception for a nonzero return code, whereas the former returns the return code for all cases.