我有python脚本,它通过统计R(通过PypeR)输出长列表。这个python脚本运行得非常好。
现在我试图通过NodeJS的派生功能从child_process运行这个脚本,但是它失败了,出现了以下错误:
Traceback (most recent call last):
File "pyper_sample.py", line 5, in <module>
r=R()
File "/home/mehtam/pyper.py", line 582, in __init__
'prog' : Popen(RCMD, stdin=PIPE, stdout=PIPE, stderr=return_err and _STDOUT or childstderr, startupinfo=info),
File "/usr/lib64/python2.6/subprocess.py", line 642, in __init__
errread, errwrite)
File "/usr/lib64/python2.6/subprocess.py", line 1234, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
./temp.sh: line 1: 27500 Segmentation fault (core dumped) python pyper_sample.py o1dn01.tsv cpu_overall
child process exited with code : 139注意:我的python脚本运行得很好。我已经手动测试过了。
发布于 2014-02-25 18:02:37
我的python脚本运行得很好。我已经手动测试过了。
输出清楚地显示OSError: No such file or directory异常发生在Popen()调用过程中。
这意味着程序找不到,
>>> from subprocess import Popen
>>> p = Popen(["ls", "-l"]) # OK
>>> total 0
>>> p = Popen(["no-such-program-in-current-path"])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory另外,将整个命令作为字符串而不是列表(默认情况下为shell=False)传递是一个常见错误:
>>> p = Popen("ls -l")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory确保:
$PATH中找到注意:您的Popen()调用通过了仅为startupinfo的startupinfo。在Unix上使用多个参数的字符串命令在"No such file or directory"错误时失败。
https://stackoverflow.com/questions/22002701
复制相似问题