Filter virtualenv lines from stackprinter dump

This commit is contained in:
Keith Edmunds 2023-10-16 20:31:32 +01:00
parent 3e2293195a
commit 64c3e3066b
2 changed files with 10 additions and 2 deletions

View File

@ -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(

View File

@ -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")