I have my own custom sys.excepthook to handle errors (via a custom error message) and it runs fine when run directly. Since updating PyCharm to version 2019.3 this function it does not work when debugging. Used to work in older versions. Instead, PyCharm just prints the stack and terminates the process.
Here's a basic code. Works when run directly but fails when debugged.
import sys
def myExceptHook(type, value, tb):
print("there's been an error")
# reroute every exception through my hook
sys.excepthook = myExceptHook
raise Exception('error')
When debugging I get the following output:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.2\plugins\python-ce\helpers\pydev\pydevd.py", line 1434, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.2\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/Projects/TubeEye/code/testraise.py", line 8, in <module>
raise Exception('error')
Exception: error
But if running directly I get (as expected):
there's been an error