我的问题是关于子流程的。
我正在使用子进程来调用外部程序,我使用了 check_output() 方法,其中我将参数作为列表传递。我注意到,当从交互式 shell 中使用 check_output() 时,需要 3 分钟(在我的情况下,这是执行外部程序的正确时间 [如果进程保持阻塞等待响应,则没有问题])当我在 python 脚本中使用相同的方法和相同的参数时,可能需要长达 1 小时!
以前有人遇到过这种情况吗?有什么建议吗?
有关信息,我在 Debian 10 上使用 Python3.7.3。
感谢是提前的
- - 编辑:
我的代码没有什么特别的
我的脚本只是:
from subprocess import check_output
try:
#commandList is the programm (external bin) I would excute with its params
result = check_output(commandList)
print(result.decode("latin-1"))
except Exception as e:
print(e)
30秒到达战场
相关分类