I use subprocess
's check_output()
function two ways,find the result are different, I don't known why.
First way:
from subprocess import check_output as qc output = qc(['exit', '1'], shell=True)
Second way:
from subprocess import check_output as qc output = qc(['exit 1'], shell=True)
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/work/cloud/python2.7_64/lib/python2.7/subprocess.py", line 544, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['exit 1']' returned non-zero exit status 1
Second way is right, but first way why is not right?