我正在尝试使用子进程从python本身运行praat文件,但是python(subprocess)似乎找不到目录。我不明白为什么自从我在终端中运行命令以来,它运行得很好。不能有人将我引导到我要去哪里了吗?这是子流程代码
import silex
import subprocess as sb
cmd_line = raw_input()
args = shlex.split(cmd_line)
p = sb.Popen(args)
当我用输入运行
Praat /Users/admirmonteiro/tmp/tmp.praat
这是我得到的错误:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Users/admirmonteiro/anaconda/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/Users/admirmonteiro/anaconda/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
如前所述,我运行命令,它们在终端中运行良好。我也尝试过运行subprocess.call,但发生相同的错误。我也尝试过使用shell = True作为参数,但是也会输出相同的错误。请帮忙 !
在外壳Praat
程序中键入以下内容以获取应用程序的完整路径。
whereis Praat
然后在您的python程序中使用完整路径。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句