我有一个无限循环来执行此操作:
print("text for debugging my issue1")
execution=["python", "-u", mainScript, directory, folder, cardIP]
_,_=subprocess.Popen(execution, shell=True).communicate()
并在MainScript
中,第一行是:
print("text for debugging my issue2")
在那之后,我只是打印了很多东西。 (在MainScript
)
现在,我的问题是,大部分时间它工作正常,我可以看到打印:
"text for debugging my issue1"
"text for debugging my issue2"
[data printed in 'MainScript']
但有时,它会卡在_,_=subprocess.Popen(execution, shell=True).communicate()
中,这意味着我看到了:
"text for debugging my issue1"
"text for debugging my issue2"
[data printed in 'MainScript']
"text for debugging my issue1"
"text for debugging my issue2"
[data printed in 'MainScript']
"text for debugging my issue1"
///Missing "text for debugging my issue2" here and all of 'MainScrip' output,
///Here it just stop working.
它只是挂起。当我按任意键时,它会立即继续工作,打印所有内容,程序从停止的位置开始运行。