blob: f1d46e39c857097008dc982eeae9a85cea68c92c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
Traceback
=========
Rich can render Python tracebacks with syntax highlighting and formatting. Rich tracebacks are easier to read, and show more code, than standard Python tracebacks.
Printing tracebacks
-------------------
The :meth:`~rich.console.Console.print_exception` method will print a traceback for the current exception being handled. Here's an example::
try:
do_something()
except:
console.print_exception()
Traceback handler
-----------------
Rich can be installed as the default traceback handler so that all uncaught exceptions will be rendered with highlighting. Here's how::
from rich.traceback import install
install()
There are a few options to configure the traceback handler, see :func:`~rich.traceback.install` for details.
|