0

I have a error.py file that is something like this:

import sys, traceback

def __error_messages_handler(type, value, tb):
    traceback.print_exception(type, value, tb)
    sys.stderr.write('Custom message')

def reg_includes():
    sys.excepthook = __error_messages_handler

On a cell on Jupyter Notebook, I write something like:

import errors
errors.reg_includes()
float('pasldspad')

I expected to see the custom message on the error message, but instead it just shows the default. How can I solve this? I saw some other topics on this subject (like this one), but I still doesnt understand how to do what I just described to work.

0 Answers0