Assuming that your command works on the command line, then deleting the argument stdout
, changing the order of the arguments, and passing a string instead of a list should be sufficient to make it reproduce the behavior on the command line.
import subprocess
subprocess.Popen("python ~/mrjobScript.py --domain {1} ~/jobs/{0}/input/* > ~/jobs/{0}/output/output-{1}.log ".format(date,domain), shell=True)
Note that this will start the subprocess and then go to the next line of your code. Your code will not wait for it. If you want your code to wait for it, you may want to use subprocess.call instead.
Note of Warning: It is recommended that the user of shell=True
consult this answer to fully understand the implications of such usage. In particular, such applications should never let user-supplied arguments get passed directly or indirectly to the argument of a call to subprocess.Popen
with shell=True
without sanitization.