我们需要使用subprocess.Popen()
执行一个系统命令
由于输出有大量数据,当我们试图使用Popen.wait()
时,它被卡住了
pipe= subprocess.Popen(cmd, shell=False,stdout=subprocess.PIPE, stderr=subprocess.PIPE)
pipe.wait()
因此,我们尝试将Popen.stdout
放入变量pstdout
。之后pstdout
被关闭,我们无法获取该文件中的内容
pipe.stdout.closed
pstdout.closed
有人能帮助我们避免挂起或重新打开pstdout
吗
引用函数
Popen.wait()
上的python文档popen:也许你会陷入僵局。用交流代替
相关问题 更多 >
编程相关推荐