The docstring of stackprinter.format states, that there is a keyword argument named suppressed_exception_types.
Using that parameter results in a stackprinter crash with the following error message:
┆ Stackprinter failed:
┆ File "/.../lib/python3.11/site-packages/stackprinter/formatting.py", line 176, in format_exc_info
┆ whole_stack = format_stack(frameinfos, style=style,
┆ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
┆ TypeError: format_stack() got an unexpected keyword argument 'suppressed_exception_types'
┆
┆ So here is your original traceback at least:
┆
┆ Traceback (most recent call last):
┆ File "/...
stackprinter.format uses stackprinter.formatting.format_exc_info internally, which has a keyword arg suppressed_exceptions.
Using suppressed_exceptions instead of suppressed_exception_types solved the TypeError.
Here is the working Formatter Class:
class VerboseExceptionFormatter(logging.Formatter):
def formatException(self, exc_info):
msg = stackprinter.format(
exc_info,
...
suppressed_exceptions=[KeyboardInterrupt, SystemExit],
...
)
return "\n".join(" ┆ " + "%s"%(line) for line in msg.split("\n"))
First of all: thanks for this great package!
The docstring of
stackprinter.format
states, that there is a keyword argument namedsuppressed_exception_types
. Using that parameter results in a stackprinter crash with the following error message:stackprinter.format
usesstackprinter.formatting.format_exc_info
internally, which has a keyword argsuppressed_exceptions
. Usingsuppressed_exceptions
instead ofsuppressed_exception_types
solved theTypeError
.Here is the working Formatter Class: