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]#
Display a warning message with enhanced formatting that enables traceback printing.
This definition is activated by setting the COLOUR_SCIENCE__COLOUR__SHOW_WARNINGS_WITH_TRACEBACK environment variable before importing colour.
- Parameters:
filename (str) – File path to read the line at
linenofrom iflineis None.lineno (int) – Line number to read the line at in
filenameiflineis None.file (TextIO | None) –
fileobject to write the warning to, defaults tosys.stderrattribute.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 replaces the
warnings.showwarning()definition with thecolour.utilities.show_warning()definition, providing complete traceback from the point where the warning occurred.