461 |
461 |
462 |
462 |
463 ignored_exceptions = [] # a problem with a line in a module is only reported once per session |
463 ignored_exceptions = [] # a problem with a line in a module is only reported once per session |
464 |
464 |
465 |
465 |
466 def AddExceptHook(path, app_version='[No version]'): #, ignored_exceptions=[]): |
466 def AddExceptHook(path, app_version='[No version]'): |
467 |
467 |
468 def handle_exception(e_type, e_value, e_traceback): |
468 def handle_exception(e_type, e_value, e_traceback): |
469 traceback.print_exception(e_type, e_value, e_traceback) # this is very helpful when there's an exception in the rest of this func |
469 traceback.print_exception(e_type, e_value, e_traceback) # this is very helpful when there's an exception in the rest of this func |
470 last_tb = get_last_traceback(e_traceback) |
470 last_tb = get_last_traceback(e_traceback) |
471 ex = (last_tb.tb_frame.f_code.co_filename, last_tb.tb_frame.f_lineno) |
471 ex = (last_tb.tb_frame.f_code.co_filename, last_tb.tb_frame.f_lineno) |
474 elif ex not in ignored_exceptions: |
474 elif ex not in ignored_exceptions: |
475 result = Display_Exception_Dialog(e_type, e_value, e_traceback) |
475 result = Display_Exception_Dialog(e_type, e_value, e_traceback) |
476 if result: |
476 if result: |
477 ignored_exceptions.append(ex) |
477 ignored_exceptions.append(ex) |
478 info = { |
478 info = { |
479 'app-title': wx.GetApp().GetAppName(), # app_title |
479 'app-title': wx.GetApp().GetAppName(), |
480 'app-version': app_version, |
480 'app-version': app_version, |
481 'wx-version': wx.VERSION_STRING, |
481 'wx-version': wx.VERSION_STRING, |
482 'wx-platform': wx.Platform, |
482 'wx-platform': wx.Platform, |
483 'python-version': platform.python_version(), #sys.version.split()[0], |
483 'python-version': platform.python_version(), |
484 'platform': platform.platform(), |
484 'platform': platform.platform(), |
485 'e-type': e_type, |
485 'e-type': e_type, |
486 'e-value': e_value, |
486 'e-value': e_value, |
487 'date': time.ctime(), |
487 'date': time.ctime(), |
488 'cwd': os.getcwd(), |
488 'cwd': os.getcwd(), |