Skip to content

Instantly share code, notes, and snippets.

@neibla
Created February 17, 2024 03:53
Show Gist options
  • Save neibla/b9651086889ca71b06d67398aab97510 to your computer and use it in GitHub Desktop.
Save neibla/b9651086889ca71b06d67398aab97510 to your computer and use it in GitHub Desktop.
Python debug with pdb

python -m pdb myscript.py

import pdb, traceback, sys

def bombs():
    a = []
    print a[0]

if __name__ == '__main__':
    try:
        bombs()
    except:
        extype, value, tb = sys.exc_info()
        traceback.print_exc()
        pdb.post_mortem(tb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment