【发布时间】:2017-07-24 15:23:13
【问题描述】:
一般来说,我尝试使用 Bash 从命令行而不是 Python 进行读取,这样我就有了制表符补全功能。我想以最简单的方式做到这一点。但是,我无法让以下代码正常工作,我想了解导致问题的原因。
Python 脚本:
from subprocess import call
call(['read', '-ep', 'Path:', 'temporaryPath'])
print temporaryPath
错误回溯:
Traceback (most recent call last):
File "tmp.py", line 2, in <module>
call(['read', '-ep', 'Path:', 'temporaryPath'])
File "/usr/lib64/python2.6/subprocess.py", line 478, in call
p = Popen(*popenargs, **kwargs)
File "/usr/lib64/python2.6/subprocess.py", line 642, in __init__
errread, errwrite)
File "/usr/lib64/python2.6/subprocess.py", line 1238, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
【问题讨论】:
-
read是内置的 bash,而不是二进制文件。
标签: python bash popen tab-completion