我运行一个脚本来执行多个进程,这些进程在不同的类中执行。除非用户要求,否则进程不会结束。所以在main类中,我决定创建一个进程来exit()脚本,我想这也会杀死所有进程。这是主.py班级。在
def finishTest():
end = "notexit"
while end != "exit":
end = input("To finish the test type 'exit'")
exit()
if __name__ == '__main__':
fT = Process (target=finishTest)
fT.start()
#this are functions of this class that call functions from other classes that run the other processes.
askTest()
execTest()
当我执行主.py出现以下错误:
^{pr2}$如何更正此错误?这不是停止脚本和脚本执行的所有进程的正确方法吗?在
谢谢大家!在
更改变量
exit
名称并尝试将其放入try except块中:输出:
^{pr2}$相关问题 更多 >
编程相关推荐