Python's post-mortem debugging (easily accessible by IPython's %debug magic) allows to step out of the exception's scope one or more times and view the variables as they were before the exception was thrown. Extremely useful.
VSCode-python has nice integration with Python's debugger. If a breakpoint is introduced, one can step in and out of functions in the editor using the debug toolbar. This is much more user friendly than using the console for debugging. However, this debug toolbar doesn't seem to work in a post mortem mode.
When a Python script is run in vscode using the "Start debugging" command (F5) and throws an exception, the exception is highlighted in vscode's editor, but stepping out doesn't work - the script immediately quits if I click step out in the debug toolbar.
Is there a way to integrate Python's post-mortem debugging with vscode's editor? Am I missing something? I was expecting this to just work.
The
step outbutton might not work, but that doesn't mean you can't look up previous frames, probe their variables, and even run expressions in those frames.All you have to do is select the frames (functions) you're interested in, in the
Call Stacksubdivision of theRun and Debugsidebar:After clicking on one of those frames, you can see the frame variables in the
Variablessubdivision, and even run expressions using them in theDebug Console.This is essentially the same functionality of the
upanddowncommands from (i)pdb that are available in the%debugmagic of IPython.