Beispiel #1
0
def debugExceptHook(type, value, tb):
    import epdb
    import traceback
    print "T-Rex Hates %s" % type.__name__
    print str(type)
    traceback.print_exception(type, value, tb)
    epdb.post_mortem(tb)
Beispiel #2
0
 def debug(self, err):
     ec, ev, tb = err
     stdout = sys.stdout
     sys.stdout = sys.__stdout__
     traceback.print_exc()
     try:
         epdb.post_mortem(tb)
     finally:
         sys.stdout = stdout
Beispiel #3
0
def excepthook(e_type, e_value, e_tb):
    if isinstance(e_value, KeyboardInterrupt):
        print >>sys.stderr
        print >>sys.stderr, 'Interrupted by Ctrl-C'
        sys.exit(-1)

    sys.excepthook = sys.__excepthook__
    util.formatTrace(e_type, e_value, e_tb, withLocals=False)
    epdb.post_mortem(e_tb, e_type, e_value)
Beispiel #4
0
 def debug(self, err):
     ec, ev, tb = err
     stdout = sys.stdout
     sys.stdout = sys.__stdout__
     try:
         traceback.print_exc()
     except Exception:
         print(*sys.exc_info())
     try:
         epdb.post_mortem(tb)
     finally:
         sys.stdout = stdout
Beispiel #5
0
 def debug(self, err):
     ec, ev, tb = err
     stdout = sys.stdout
     sys.stdout = sys.__stdout__
     try:
         traceback.print_exc()
     except Exception:
         print(*sys.exc_info())
     try:
         epdb.post_mortem(tb)
     finally:
         sys.stdout = stdout
Beispiel #6
0
    def excepthook(typ, value, tb):
        if typ is bdb.BdbQuit:
            sys.exit(1)
        sys.excepthook = sys.__excepthook__

        if debugger_flag and sys.stdout.isatty() and sys.stdin.isatty():
            if debugger.__name__ == 'epdb':
                debugger.post_mortem(tb, typ, value)
            else:
                debugger.post_mortem(tb)
        elif debug_flag:
            print >> sys.stderr, traceback.print_tb(tb)
            sys.exit(1)
        else:
            print >> sys.stderr, value
            sys.exit(1)
Beispiel #7
0
    def excepthook(typ, value, tb):
        if typ is bdb.BdbQuit:
            sys.exit(1)
        sys.excepthook = sys.__excepthook__

        if debugger_flag and sys.stdout.isatty() and sys.stdin.isatty():
            if debugger.__name__ == 'epdb':
                debugger.post_mortem(tb, typ, value)
            else:
                debugger.post_mortem(tb)
        elif debug_flag:
            print traceback.print_tb(tb)
            sys.exit(1)
        else:
            print value
            sys.exit(1)
Beispiel #8
0
def _debugger_except_hook(type_, value, tracebk):
    '''
    Launch epdb (or pdb if epdb is unavailable) when an uncaught exception
    occurs.
    '''
    if type_ is bdb.BdbQuit:
        sys.exit(1)
    sys.excepthook = sys.__excepthook__

    if sys.stdout.isatty() and sys.stdin.isatty():
        if 'epdb' in sys.modules:
            epdb.post_mortem(tracebk, type_, value)
        else:
            pdb.post_mortem(tracebk)
    else:
        traceback.print_tb(tracebk)
        sys.exit(1)
Beispiel #9
0
def _debugger_except_hook(type_, value, tracebk):
    '''
    Launch epdb (or pdb if epdb is unavailable) when an uncaught exception
    occurs.
    '''
    if type_ is bdb.BdbQuit:
        sys.exit(1)
    sys.excepthook = sys.__excepthook__

    if sys.stdout.isatty() and sys.stdin.isatty():
        if 'epdb' in sys.modules:
            epdb.post_mortem(tracebk, type_, value)
        else:
            pdb.post_mortem(tracebk)
    else:
        traceback.print_tb(tracebk)
        sys.exit(1)
Beispiel #10
0
    def excepthook(typ, value, tb):
        if typ is bdb.BdbQuit:
            sys.exit(1)
        sys.excepthook = sys.__excepthook__

        if debugger_flag and sys.stdout.isatty() and sys.stdin.isatty():
            if debugger.__name__ == 'epdb':
                debugger.post_mortem(tb, typ, value)
            else:
                debugger.post_mortem(tb)
        elif debugger_flag and debugger.__name__ == 'epdb':
            random.seed(); port = random.randint(8100, 9000)
            debugger.serve_post_mortem(tb, typ, value, port=port)
        elif debug_flag:
            traceback.print_exception(typ, value, tb)
            sys.exit(1)
        else:
            print value
            sys.exit(1)
Beispiel #11
0
    def excepthook(typ, value, tracebk):
        '''
        If the debugger option is enabled, launch epdb (or pdb if epdb is
        unavailable) when an uncaught exception occurs.
        '''
        if typ is bdb.BdbQuit:
            sys.exit(1)
        sys.excepthook = sys.__excepthook__

        if debugger_enabled and sys.stdout.isatty() and sys.stdin.isatty():
            if 'epdb' in sys.modules:
                epdb.post_mortem(tracebk, typ, value)
            else:
                pdb.post_mortem(tracebk)
        elif debug_enabled:
            traceback.print_tb(tracebk)
            sys.exit(1)
        else:
            print value
            sys.exit(1)
Beispiel #12
0
def excepthook(typ, value, tb):
    if typ is bdb.BdbQuit:
        sys.exit(1)
    sys.excepthook = sys.__excepthook__

    debugger.post_mortem(tb, typ, value)
Beispiel #13
0
def excepthook(typ, value, tb):
    if typ is bdb.BdbQuit:
        sys.exit(1)
    sys.excepthook = sys.__excepthook__

    debugger.post_mortem(tb, typ, value)