Wish debugger to show variables as set immediately before Exception

When PyCharm runs a python script and an exception is present it shows a stack trace in the console, but no variables are present in the variables window.

I'm wondering if when a fatal exception occurs PyCharm could provide me more insight into what was happening at the time. I think this should be possible from my experience with other IDEs. And, although my memory may be playing tricks on me, I thought this had been the case in PyCharm.

If there are any settings changes I could make to enable this feature I'd greatly appreciate any advice that anyone can provide.


Have you tried using Debug functionality of PyCharm? If you just run Debug without any breakpoints, and it will reach the exception, it will show the variables with their values in a separate tab.


Thanks for your response Andrey. Since posting I've noticed that sometimes it does in fact work as you describe, but there are plenty of time when it doesn't merely ending with console output and so far I can't work out which exceptions cause this. I'll post the next example I see.

Hi Nick, If you want to analyze the variables up until a certain point in your program, you can place some breakpoints, then PyCharm should display the variables state at each breakpoint, and it should do that every time.

Thanks but I want to debug at the point an exception occurs whenever that may be. It won’t be every time execution passes over a breakpoint.


Please sign in to leave a comment.