Hacker News new | ask | show | jobs
by hcarvalhoalves 4598 days ago
You don't need this trickery.

    $ python -m pdb yourscript.py
    (Pdb) c
Will let you inspect the local scope after an uncaught exception.
1 comments

Yeah, that's probably a better general solution. That said, there are some contexts, e.g. working on academic research code which is always buggy, where you really do want debugger-on-exception to be the default behavior, so that you don't have to remember to type -m pdb every single time you run your code. I guess you could alias python to "python -m pdb", but that's opening a whole new can of worms. :-)