colour.utilities.show_warning#
- colour.utilities.show_warning(message: Warning | str, category: Type[Warning], filename: str, lineno: int, file: TextIO | None = None, line: str | None = None) None [source]#
Alternative
warnings.showwarning()
definition that allows traceback printing.This definition is expected to be used by setting the COLOUR_SCIENCE__COLOUR__SHOW_WARNINGS_WITH_TRACEBACK environment variable prior to importing colour.
- Parameters:
filename (str) – File path to read the line at
lineno
from ifline
is None.lineno (int) – Line number to read the line at in
filename
ifline
is None.file (TextIO | None) –
file
object to write the warning to, defaults tosys.stderr
attribute.line (str | None) – Source code to be included in the warning message.
- Return type:
None
Notes
Setting the COLOUR_SCIENCE__COLOUR__SHOW_WARNINGS_WITH_TRACEBACK environment variable will result in the
warnings.showwarning()
definition to be replaced with thecolour.utilities.show_warning()
definition and thus providing complete traceback from the point where the warning occurred.