我使用subprocess
在两个进程之间交换数据
我使用以下内容编辑repeat.py
文件:
此文件是来自http://www.doughellmann.com/PyMOTW/subprocess/的示例
import sys
sys.stderr.write('repeater.py: starting\n')
sys.stderr.flush()
while True:
next_line = sys.stdin.readline()
if not next_line:
break
sys.stdout.write(next_line)
sys.stdout.flush()
sys.stderr.write('repeater.py: exiting\n')
sys.stderr.flush()
并在ipython
中运行此文件
为什么没有定义teststs
?在
您似乎正在启动一个交互式Python会话,而不是运行
repeat.py
。尝试删除shell=True
,它与参数列表一起没有意义。(顺便说一句,使用shell=True
几乎总是个坏主意。)在最初的5次按键操作中会出现一些奇怪的行为。我不知道为什么。之后,如果工作正常,并且我们可以访问
ls -l
,cd
,当按UP键时,以前的命令行似乎有完整的功能。在Here是我类似的问题。在
相关问题 更多 >
编程相关推荐