Pycharm debugger, step over last line in class
Answered
Hi,
I'm new to PyCharm, just evaluating the Pro version now as I'm switching from Wing. I'm having some problems with the debugger:
Say I have a class and the last line creates an array. I put a breakpoint on it, and as expected - execution stops on the breakpoint, but as soon as I step over it goes out of the class, then in my debug console I can't access the array or anything local to that class. I know there's a way around it - break on the last line, and just run it in the console manually, but is there a way to step over the last line and wait, so that I can easily inspect values of my variables, plot arrays, etc. like Wing does?
Thanks in advance,
Michal
Please sign in to leave a comment.
Hi,
Have you tried Step Into and Step Into My Code? https://www.jetbrains.com/help/pycharm/stepping-through-the-program.html
You can also click Show Python Prompt in the Console of debug tool window to make some operations.
Thanks for getting back to me Sergey. I did try all of these options and they just step over to the next point (in a different file). But that's fine, I can make it work with just right clicking and running the line in the console, which, obviously, brings up the console, which is nice. I'll just stick to that:)
When you have an array in class, it is not shown in debug tool window with other variables and arrays, you should check Special Variables, find your class and there you should see your array. Can you please check that?
I think what he means is that it's not possible to set a breakpoint right after a given line if it's the last line in an indented block (function/method/for-block/etc.) This makes it impossible to inspect the result of the execution of this line because after stepping over it the debugger will step out of the indented block.
Sometimes I have this issue too and have to add a temporary line with a "pass" in it after the line I want to inspect just to be able to set a breakpoint to it.