Skip to content

Instantly share code, notes, and snippets.

@rahulrajaram
Created December 10, 2018 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahulrajaram/9566e051a76c5c9b1612acf3e5117e22 to your computer and use it in GitHub Desktop.
Save rahulrajaram/9566e051a76c5c9b1612acf3e5117e22 to your computer and use it in GitHub Desktop.
Save stack trace to file
import traceback
def print_stack_trace():
try:
raise Exception
except Exception:
with open('~/.my_important_stack_trace', 'w') as file:
file.write('{}'.format(repr(traceback.format_stack())))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment