在Python调用线程中捕获线程的异常
....
try: threadClass = TheThread(param1, param2, etc.) threadClass.start() ##### **Exception takes place here**except: print "Caught an exception"
sys.exc_info()
编辑:
class TheThread(threading.Thread): def __init__(self, sourceFolder, destFolder): threading.Thread.__init__(self) self.sourceFolder = sourceFolder self.destFolder = destFolder def run(self): try: shul.copytree(self.sourceFolder, self.destFolder) except: raise
梵蒂冈之花
慕后森
相关分类