Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def full_stack():
- import traceback, sys
- exc = sys.exc_info()[0]
- stack = traceback.extract_stack()[:-1] # last one would be full_stack()
- if exc is not None: # i.e. an exception is present
- del stack[-1] # remove call of full_stack, the printed exception
- # will contain the caught exception caller instead
- trc = 'Traceback (most recent call last):\n'
- stackstr = trc + ''.join(traceback.format_list(stack))
- if exc is not None:
- stackstr += ' ' + traceback.format_exc().lstrip(trc)
- return stackstr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement