@ show0k gave the correct answer to my question (regarding magic methods). Many thanks!:)
This answer inspired me to go a little deeper, and I came across an IPython method that allows you to define a special exception handler for the entire laptop .
I got it like this:
from IPython.core.ultratb import AutoFormattedTB
Thus, it can be placed in one cell at the top of any laptop, and as a result, it will do newsletters if something goes wrong.
Note on self / TODO: make this snippet in a small python module that can be imported into notepad and activated using line magic.
Be careful. The documentation contains a warning for this set_custom_exc method: "WARNING: adding your own exception handler to the main IPythons runtime will give you very good chances of unpleasant crashes. This tool should only be used if you really know what you are doing" .
source share