Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pdb
- import sys
- import traceback
- class nob:
- def __init__(self):
- self.D = bytearray(b'', 'utf-8')
- def R(self, r):
- self.D.extend(r)
- def L(self, l):
- if(l <= len(self.D)):
- return self.D[l-1]
- def A(self, a):
- if(a < len(self.D)):
- return(self.D[-a:])
- elif(a == len(self.D)):
- return(self.D)
- else:
- exit(0)
- def excepthook(type, value, tb):
- print "*** print_stack:"
- traceback.print_stack()
- pdb.set_trace()
- try:
- sys.excepthook = excepthook
- print(dir(traceback))
- Nob = nob()
- Nob.R('D')
- Nob.D.extend(Nob.D)
- print(Nob.L(3))
- print(Nob.A(1))
- except Exception as err:
- exc_type, exc_value, exc_traceback = sys.exc_info()
- print "*** print_tb:"
- traceback.print_tb(exc_traceback, limit=1, file=sys.stdout)
- print "*** print_exception:"
- traceback.print_exception(exc_type, exc_value, exc_traceback,
- limit=2, file=sys.stdout)
- print "*** print_exc:"
- traceback.print_exc()
- print "*** format_exc, first and last line:"
- formatted_lines = traceback.format_exc().splitlines()
- print formatted_lines[0]
- print formatted_lines[-1]
- print "*** format_exception:"
- print repr(traceback.format_exception(exc_type, exc_value,
- exc_traceback))
- print "*** extract_tb:"
- print repr(traceback.extract_tb(exc_traceback))
- print "*** format_tb:"
- print repr(traceback.format_tb(exc_traceback))
- print "*** tb_lineno:", exc_traceback.tb_lineno
- pdb.set_trace()
Add Comment
Please, Sign In to add comment