' > '
is a shell redirection syntax. Popen
doesn't spawn the shell unless you ask (you shouldn't). If you want to redirect the output of a subprocess to a file then use stdout=file_object
parameter e.g.:
from subprocess import check_call
with open('/path/to/output', 'wb', 0) as output_file:
check_call(['command', 'arg1', 'arg2'], stdout=output_file)