Python 线程中未处理的异常
运行以下代码时,我收到一个错误:Python 线程中未处理的异常,python,multithreading,Python,Multithreading,运行以下代码时,我收到一个错误: def waitForValues(F2,G2, sheet, index): while True: if G2>0 and F2>0: Team1Probability = (F2/(F2 + G2))*100 Team2Probability = (G2/(F2 + G2))*100 sheet.write(1,7,Team1Probability
def waitForValues(F2,G2, sheet, index):
while True:
if G2>0 and F2>0:
Team1Probability = (F2/(F2 + G2))*100
Team2Probability = (G2/(F2 + G2))*100
sheet.write(1,7,Team1Probability)
sheet.write(1,8,Team2Probability)
if Team1Probability > Team2Probability:
sheet.write(1,9,index.split("Vs")[0].strip())
else:
sheet.write(1,9,index.split("Vs")[1].strip())
break;
else:
time.sleep(1)
print "waiting for values"
continue
def func(workSheetList):
w = copy(open_workbook(pAflPredictionFileName))
for index in workSheetList:
sheet = w.get_sheet(2)
F2 = workbook.sheet_by_name(index).cell_value(1,5)
G2 = workbook.sheet_by_name(index).cell_value(1,6)
thread.start_new_thread( waitForValues, (F2,G2, sheet, index))
错误显示:
Unhandled exception in thread started by <function waitForValues at 0x0250C970>close failed in file object destructor:
sys.excepthook is missing
lost sys.stderr
任何机构都能帮助解决这个错误吗?请帮助我您正在使用
线程
模块,该模块的文档建议使用线程
。