Reputation: 8455
When a script ends with an error during debugging, PyCharm got disconnected from pydev
. So, the state of variable at the moment of the error remains unknown.
How can I find out the very latest values of variables right before the error happens?
Updated: This problem arises only when you try to debug a unit test. You have to check "Activation policy: On raise" for "All Breakpoints" in the list of breakpoints.
Upvotes: 2
Views: 2956
Reputation: 1759
The simplest solution would be setting a breakpoint just before/at the wanted line so you can see the variables just before the exception is called.
It's also possible to set an "exception breakpoint". This stops the script when a specific exception is encountered. Open "Run" > "View Breakpoints", click on the "+" sign and add a "Python Exception Breakpoint". Now you have to choose a specific exception.
Upvotes: 4