python中的subprocess.call没有等待它完成

时间:2017-06-09 13:36:01

标签: python subprocess

当我尝试从python调用python脚本并使用subprocess.call将输出存储在文本文件中时,它不等待进程完成,并且在使用subprocess.check_call时它显示错误"返回非零退出状态1"。

Python 2.7 - Windows Server 2012

当我独立运行时,子流程正常工作。

以下是我要执行的代码

with open("output.txt", "w+") as output:
    subprocess.call(["python", "C:\flycoffee\user.py ", '-q 
    ', 'F34D989B207E003CD9DB40BC2AD0CEC5'], stdout = output)

with open("output.txt", "w+") as output:
    subprocess.check_call(["python", "C:\flycoffee\user.py ", '-q 
    ', 'F34D989B207E003CD9DB40BC2AD0CEC5'], stdout = output)

0 个答案:

没有答案
相关问题