解决subprocess.Popen启动两条进程

本文共有446个字,关键词:

问题:使用subprocess.Popen启动进程时,启动了两条进程,如何解决?

解决:添加executable='bash'

方法:

cmd_date = 'python test_01.py'
process = subprocess.Popen(cmd_date, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, executable='bash')
stdout, stderr = process.communicate()
print(stdout, stderr, process.pid)

参考:

https://blog.csdn.net/weixin_44316541/article/details/102600955
版权声明:本文为作者原创,如需转载须联系作者本人同意,未经作者本人同意不得擅自转载。
添加新评论
暂无评论