Beremiz.py
changeset 1645 91b7cc4b0d44
parent 1633 f629a91b456d
child 1646 2d1fb99065e8
equal deleted inserted replaced
1644:976ce8c6195d 1645:91b7cc4b0d44
  1227         traceback.print_exception(e_type, e_value, e_traceback) # this is very helpful when there's an exception in the rest of this func
  1227         traceback.print_exception(e_type, e_value, e_traceback) # this is very helpful when there's an exception in the rest of this func
  1228         last_tb = get_last_traceback(e_traceback)
  1228         last_tb = get_last_traceback(e_traceback)
  1229         ex = (last_tb.tb_frame.f_code.co_filename, last_tb.tb_frame.f_lineno)
  1229         ex = (last_tb.tb_frame.f_code.co_filename, last_tb.tb_frame.f_lineno)
  1230         if ex not in ignored_exceptions:
  1230         if ex not in ignored_exceptions:
  1231             date = time.ctime()
  1231             date = time.ctime()
       
  1232             try:
       
  1233                 os.mkdir(path)
       
  1234             except OSError:
       
  1235                 pass
  1232             bug_report_path = path+os.sep+"bug_report_"+date.replace(':','-').replace(' ','_')+".txt"
  1236             bug_report_path = path+os.sep+"bug_report_"+date.replace(':','-').replace(' ','_')+".txt"
  1233             result = Display_Exception_Dialog(e_type,e_value,e_traceback,bug_report_path)
  1237             result = Display_Exception_Dialog(e_type,e_value,e_traceback,bug_report_path)
  1234             if result:
  1238             if result:
  1235                 ignored_exceptions.append(ex)
  1239                 ignored_exceptions.append(ex)
  1236                 info = {
  1240                 info = {
  1259                 output = open(bug_report_path,'w')
  1263                 output = open(bug_report_path,'w')
  1260                 lst = info.keys()
  1264                 lst = info.keys()
  1261                 lst.sort()
  1265                 lst.sort()
  1262                 for a in lst:
  1266                 for a in lst:
  1263                     output.write(a+":\n"+str(info[a])+"\n\n")
  1267                     output.write(a+":\n"+str(info[a])+"\n\n")
       
  1268                 output.close()
  1264 
  1269 
  1265     #sys.excepthook = lambda *args: wx.CallAfter(handle_exception, *args)
  1270     #sys.excepthook = lambda *args: wx.CallAfter(handle_exception, *args)
  1266     sys.excepthook = handle_exception
  1271     sys.excepthook = handle_exception
  1267 
  1272 
  1268     init_old = threading.Thread.__init__
  1273     init_old = threading.Thread.__init__
  1279         self.run = run_with_except_hook
  1284         self.run = run_with_except_hook
  1280     threading.Thread.__init__ = init
  1285     threading.Thread.__init__ = init
  1281 
  1286 
  1282 if __name__ == '__main__':
  1287 if __name__ == '__main__':
  1283     # Install a exception handle for bug reports
  1288     # Install a exception handle for bug reports
  1284     AddExceptHook(os.getcwd(),version.app_version)
  1289     logpath = tempfile.gettempdir()+os.sep+'Beremiz'
       
  1290     AddExceptHook(logpath ,version.app_version)
  1285 
  1291 
  1286     frame = Beremiz(None, projectOpen, buildpath)
  1292     frame = Beremiz(None, projectOpen, buildpath)
  1287     if splash:
  1293     if splash:
  1288         splash.Close()
  1294         splash.Close()
  1289     frame.Show()
  1295     frame.Show()