The PyCharm debugger has the feature to set breakpoints at raised exceptions. However if an exception is handled inside a try except block it is not raised. How to deal with this if I want to debug within the try block? I could comment out the try except parts but this seems too cumbersome. Is there a better solution?
In the breakpoints settings (Either the
icon in the debug toolbar, or ctrl+shft+F8), you can set exception breakpoints.
The "Activation Policy" is usually set by default to "On termination". But since you handle the error, there is no termination. To activate the breakpoint immediately, even if the error is handled, you need to set the activation policy to "On raise":

Note: that warning sign which says: "This option may slow down the debugger"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With