0
在我的劇本我有以下行:的Python:subprocess.Popen返回OSERROR:[錯誤2]沒有這樣的文件或目錄
proc = subprocess.Popen(["qstat", "-xml", "-u", "*", "-r", "-s", "r"], stdout=subprocess.PIPE)
當我運行它,它工作正常,但是當它被設置作爲一個cronjob我回來了:
Traceback (most recent call last): File
File "/seq/software/current/bin/createOpsDashboard.py", line 171,
in get_pod_occupied_slots
proc = subprocess.Popen(["qstat", "-xml", "-u", "*", "-r", "-s", "r"], stdout=subprocess.PIPE)
File "/software/free/Linux/redhat_5_x86_64/pkgs/python_2.7.1-sqlite3-rtrees/lib/python2.7/subprocess.py", line 672, in __init__ errread, errwrite)
File "/software/free/Linux/redhat_5_x86_64/pkgs/python_2.7.1-sqlite3-rtrees/lib/python2.7/subprocess.py", line 1202, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
這是什麼原因造成的? cronjob正在調用一個加載Python-2.7的shell腳本,然後調用真實腳本。
莫非文件權限問題? – jcfollower
無關(搭配chmod 755還是什麼?):你確定你想通過''的*字面上代替'glob.glob( '*')'? – jfs