线程中未处理的异常

时间:2014-06-10 08:11:41

标签: python multithreading

运行以下代码时出现错误:

错误说:

Unhandled exception in thread started by <function waitForValues at 0x0250C970>close failed in file object destructor:
sys.excepthook is missing
lost sys.stderr

我使用以下代码:

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))

任何人都可以帮助解决错误吗?请帮帮我

0 个答案:

没有答案