0

Every time there is an execution error, the Jupyter Notebook crashes without showing the error on the notebook, but showing it on the Jupyter prompt.

It forces me to restart the notebook and execute all the cells each time.

Screenshot of the Notebook freezing when writing an error

[IPKernelApp] ERROR | Exception in message handler:

Traceback (most recent call last):
  File "/Users/<username>/.pyenv/versions/<venv-name>/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3251, in run_code
   exec(code_obj, self.user_global_ns, self.user_ns)
  File "/var/folders/2n/9hgs5nvd6p35c_rzn95txrph00xv/T/ipykernel_7095/881478447.py", line 1, in <module>
   1+"letters"
TypeError: unsupported operand type(s) for +: 'int' and 'str'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/<username>/.pyenv/versions/<venv-name>/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 1934, in showtraceback
   stb = value._render_traceback_()
AttributeError: 'TypeError' object has no attribute '_render_traceback_'

1 Answers1

0

Hotfix

This doesn't solve the problem, but it provides temporary fix for the problem. It allows to show the bug/execution error without crashing the notebook

import traceback
try:
   1+"letters"
except:
   traceback.print_exc()
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 25 '22 at 09:27