python subprocess抛出错误“没有这样的文件或目录”

时间:2011-06-13 12:57:15

标签: python subprocess

s=subprocess.Popen(['/home/karthik/Downloads/stanford-parser-2011-06-08/lexparser.csh','-'],stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE)

Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python2.7/subprocess.py", line 672, in __init__
        errread, errwrite)
      File "/usr/lib/python2.7/subprocess.py", line 1213, in _execute_child
        raise child_exception
    OSError: [Errno 2] No such file or directory

我确定这个文件存在,而且这个文件名的open()有效。为什么我收到此错误?我使用python 2.7

1 个答案:

答案 0 :(得分:4)

确保csh已安装并位于/bin/csh中(否则请在lexparser.sh中的shebang之后编辑命令。)