我正在尝试使用下面的脚本检查 check_output 的使用情况并遇到编译错误,我哪里出错了?
import os
import subprocess
from subprocess import check_output
#result = subprocess.check_output(['your_program.exe', 'arg1', 'arg2'])
SCRIPT_ROOT=subprocess.check_output(["pwd","shell=True"])
print SCRIPT_ROOT
def main ():
pass
if __name__ == '__main__':
main()
Traceback (most recent call last):
File "test.py", line 3, in <module>
from subprocess import check_output
ImportError: cannot import name check_output