I'm using PyCharm for debugging. One of the big headaches that I keep having is that even in debug mode, the IDE exits on an exception instead of breaking. There are already questions about this issue but they're all years or even a decade old, and PyCharm's UI has been heavily redesigned in the past years. Here's the Breakpoints window. Link to the image (not enough reputation :(): https://i.stack.imgur.com/XPl1Z.jpg) If I check the 'On raise' box, it breaks on handled exceptions which is unnecessary and unwieldy. Here's the debug console. I want it to break on the failed assert instead of just exiting. https://i.stack.imgur.com/4n6Q6.jpg
Asked
Active
Viewed 1,724 times
1 Answers
3
Your settings seem OK. When I tried to reproduce the case the PyCharm IDE just stopped right at the AssertationError. Note the debug window in the bottom of the GUI where you can inspect the stack trace and variables. The last line Process finished with exit code 1
of your screenshot was not printed at that point.
Possible cases for exiting:
- running the code (Shift+F10) instead of debugging (Shift+F9)
- using a library that actually handles the exception (e.g. Jupyter notebook or
unittest
module) - and a less probale scenario that should have other symptoms: the python version 3.7 may be too new to the specific PyCharm, at least there was an incompatibility when using numpy https://intellij-support.jetbrains.com/hc/en-us/community/posts/360001194720-Numpy-import-error-in-PyCharm-Importing-the-multiarray-numpy-extension-module-failed-
This question is a possible duplicate for Break on unhandled exception in pycharm

Marcell Stippinger
- 51
- 3