Uninstall rich.traceback? #1947
-
Is there a way to return to standard tracebacks (without from rich.traceback import install
install() I tried commenting out the above block and re-run the code, but tracebacks are still rendered via def excepthook(exctype, value, traceback): # real signature unknown; restored from __doc__
"""
excepthook(exctype, value, traceback) -> None
Handle an exception by displaying it with a traceback on sys.stderr.
"""
pass Of course I could recreate the environment and this would probably work, but I would like to give the user the option to flexibly toggle on/off the use of from rich.traceback import uninstall
uninstall() which could be called conditionally on some user input. Or maybe there is an other workaround? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
IIRC install returns the original excepthook, so you can restore it afterwards. However, you may be better off handling exceptions explicitly in your code. Assuming you have some top level entry point. try:
run()
except Exception:
if rich_exceptions:
console.print_exception()
else:
raise |
Beta Was this translation helpful? Give feedback.
-
What should I do if I run a package (in this case, Kedro) installing Is it possible to revert the installation of |
Beta Was this translation helpful? Give feedback.
IIRC install returns the original excepthook, so you can restore it afterwards.
However, you may be better off handling exceptions explicitly in your code. Assuming you have some top level entry point.