with open('/tmp/outfile', 'w') as f: subprocess.check_call(['command', 'arg1', 'arg2'], stdout=f)