def set_trace(self, frame=None): """ """ update_stdout() wrap_sys_excepthook() if frame is None: frame = sys._getframe().f_back #pdb = Tdb(def_colors) self.reset() self.set_step() sys.settrace(self.trace_dispatch)
def set_trace(frame=None): update_stdout() wrap_sys_excepthook() if frame is None: frame = sys._getframe().f_back pdb = Pdb(def_colors) # set hook pdb.shell.set_hook('synchronize_with_editor', synchronize_with_editor) pdb.set_trace(frame)
def start_debugging(): """Start a debugging session after catching an exception. This prints the traceback and start ipdb session in the frame of the error. """ exc_type, exc_value, exc_tb = sys.exc_info() if hasattr(exc_value, '_ipdbugger_let_raise'): raise print() for line in traceback.format_exception(exc_type, exc_value, exc_tb): print(colored(line, 'red'), end=' ') # Get the frame with the error. test_frame = sys._getframe(-1).f_back from ipdb.__main__ import wrap_sys_excepthook, def_colors wrap_sys_excepthook() IPDBugger(def_colors).set_trace(test_frame)