This is a question I have wondered about for quite some time, yet I have never found a suitable solution. If I run a script and I come across, let\'s say an IndexError, pyth
If you are running a module:
python -m mymodule
And now you want to enter pdb when an exception occurs, do this:
PYTHONPATH="." python -m pdb -c c mymodule/__main__.py
(or extend your PYTHONPATH). The PYTHONPATH is needed so that the module is found in the path, since you are running the pdb module now.