Ich versuche, unten Befehl mit Python-Subprozess auszuführen, aber es ist fehlgeschlagen.Python Subprozess check_output
Bitte helfen
import subprocess
cmd = "bash /opt/health_check -t 2>/dev/null"
retcode = subprocess.call([cmd])
print retcode
ich unten Ausgang bin immer:
Traceback (most recent call last):
File "./script.py", line 65, in <module>
retcode = subprocess.call([cmd])
File "/usr/lib64/python2.7/subprocess.py", line 522, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib64/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib64/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Oder mit einer Liste, bevor die Hand starten, oder versuchen, mit 'shlex.split()' auf der Saite zuerst ein ... –