Skip to content

Instantly share code, notes, and snippets.

@cauethenorio
Created February 6, 2019 01:30
Show Gist options
  • Save cauethenorio/8d6a01ef591d6743252b4354569c1973 to your computer and use it in GitHub Desktop.
Save cauethenorio/8d6a01ef591d6743252b4354569c1973 to your computer and use it in GitHub Desktop.
Python script template with debugger
#!/usr/bin/env python
# https://news.ycombinator.com/item?id=19078825
import traceback
import pdb
import sys
def main():
# some WIP code that maybe raises an exception
return 0
if __name__ == "__main__":
try:
ret = main()
except:
traceback.print_exc()
pdb.post_mortem()
sys.exit(ret)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment