Skip to content

Commit

Permalink
fix late init
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Mandic <mandic00@live.com>
  • Loading branch information
vladmandic committed Jan 31, 2025
1 parent 749ae49 commit ac1d278
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions installer.py
Original file line number Diff line number Diff line change
@@ -67,6 +67,14 @@ class Dot(dict): # dot notation access to dictionary attributes
ts = lambda *args, **kwargs: None # pylint: disable=unnecessary-lambda-assignment


def get_console():
return console


def get_log():
return log


def install_traceback(suppress: list = []):
from rich.traceback import install as traceback_install
from rich.pretty import install as pretty_install
5 changes: 4 additions & 1 deletion modules/errors.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import logging
import warnings
from installer import log, console, setup_logging, install_traceback
from installer import get_log, get_console, setup_logging, install_traceback


log = get_log()
setup_logging()
install_traceback()
already_displayed = {}
@@ -22,6 +23,7 @@ def print_error_explanation(message):

def display(e: Exception, task: str, suppress=[]):
log.error(f"{task or 'error'}: {type(e).__name__}")
console = get_console()
console.print_exception(show_locals=False, max_frames=16, extra_lines=1, suppress=suppress, theme="ansi_dark", word_wrap=False, width=console.width)


@@ -40,6 +42,7 @@ def run(code, task: str):


def exception(suppress=[]):
console = get_console()
console.print_exception(show_locals=False, max_frames=16, extra_lines=2, suppress=suppress, theme="ansi_dark", word_wrap=False, width=min([console.width, 200]))


0 comments on commit ac1d278

Please # to comment.