logo

... rich: save



Notes

Here's the code used in this video.

import time
from rich.console import Console
from rich.traceback import install 
install() 

def add_two(n1, n2):
    console.log("About to add two numbers.", log_locals=True)
    return n1 + n2

try:
    console = Console(record=True)
    for i in range(10):
        time.sleep(0.2)
        add_two(1, i)
    add_two(1, 'a')
except: 
    console.print_exception()

console.save_html("demo.html")

Feedback? See an issue? Something unclear? Feel free to mention it here.



If you want to be kept up to date, consider signing up for the newsletter.