我有一个执行此操作的无限循环:
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.
它只是挂起。当我按下任何键时,它会立即继续工作,打印所有内容,并且程序从它停止的地方运行。