From 64c3e3066b43584c2e62ea551d9f236c41ebee7e Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Mon, 16 Oct 2023 20:31:32 +0100 Subject: [PATCH] Filter virtualenv lines from stackprinter dump --- app/log.py | 6 +++++- app/musicmuster.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/log.py b/app/log.py index 0bbe460..fc90696 100644 --- a/app/log.py +++ b/app/log.py @@ -75,7 +75,11 @@ def log_uncaught_exceptions(_ex_cls, ex, tb): print("\033[1;31;47m") logging.critical("".join(traceback.format_tb(tb))) print("\033[1;37;40m") - print(stackprinter.format(ex, style="darkbg")) + print( + stackprinter.format( + ex, suppressed_paths=["/pypoetry/virtualenvs/"], style="darkbg" + ) + ) if os.environ["MM_ENV"] == "PRODUCTION": msg = stackprinter.format(ex) send_mail( diff --git a/app/musicmuster.py b/app/musicmuster.py index d0e0b3a..19bfabd 100755 --- a/app/musicmuster.py +++ b/app/musicmuster.py @@ -2180,5 +2180,9 @@ if __name__ == "__main__": ) else: print("\033[1;31;47mUnhandled exception starts") - print(stackprinter.format(exc, style="darkbg")) + print( + stackprinter.format( + exc, suppressed_paths=["/pypoetry/virtualenvs/"], style="darkbg" + ) + ) print("Unhandled exception ends\033[1;37;40m")