Search code examples
pythondebuggingpycharmremote-debugging

Pycharm Debugging: When an error occurs, the programm exits on local, but on remote it is possible to view variables. How to activate this on local?


When I debug a program with PyCharm, which runs on remote and an error occurs, I can view the current state of the program just before the error, view variables etc.

This is unfortunately not the case for programs executed on local. The program exits with the traceback and it is not possible to view variables etc. Is there a way to activate this feature for local as well?

Using Pycharm Professional 2020.3


Solution

  • Make sure you enable breakpoints on "Any Exception"

    Go to the breakpoints menu enter image description here

    Enable the "Any exceptions" breakpoint enter image description here

    With these settings I was able to make a local script pause on exceptions:

    print("Hello")
    raise Exception("World")
    

    enter image description here With: enter image description here

    Make sure to DEBUG the configuration, not "Run" - that ignores all breakpoints