Can I use Rich to render HTML tracebacks? #1409
Answered
by
willmcgugan
dhirschfeld
asked this question in
Q&A
-
I need a nice HTML repr of exceptions and I've heard good things about Rich so I'm wondering if I can use Rich for this job? I think the answer is yes. From poking about I think it may be possible to use the jupyter support to do this but, not being familiar with Rich itself, I'm not 100% sure so just looking for confirmation... and maybe an example! 😁 |
Beta Was this translation helpful? Give feedback.
Answered by
willmcgugan
Aug 16, 2021
Replies: 1 comment 1 reply
-
Something along these lines? from rich.console import Console
console = Console(record=True)
try:
1 / 0
except:
console.print_exception()
console.save_html("exc.html") |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
dhirschfeld
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Something along these lines?