1
나는 내가 이것을 실행하면, 내가commands.getstatusoutput sh : 구문 오류 : ";" 예상치 못한
sh: Syntax error: ";" unexpected
I로 오류가 utilities.py
def execute(command):
if not command:
return (-1, 'command can not be empty or null')
return commands.getstatusoutput(command)
에
status = utilities.execute(mongoimport)
으로 파이썬 명령 모듈을 사용하여 mongoimport 명령을 실행하고 보십시오 documentation는 말합니다 :
commands.getstatusoutput(cmd)
Execute the string cmd in a shell with os.popen() and return a 2-tuple (status, output). cmd is actually run as { cmd ; } 2>&1, so that the returned output will contain output or error messages
이 명령을 실행하려면 어떻게해야합니까?
[명령] (http://docs.python.org/library/commands.html)은 2.6에서 더 이상 사용되지 않으며 3.x에서 제거되었으며 [subprocess] (http://docs.python.org/library)를 사용하십시오. /commands.html) – KurzedMetal