How to suppressing warnings? #815
-
This is, I'm sure, an incredibly dumb question, but: I'd like to tidy up the output of some tools I'm building that use colour-science, and would like to suppress some of the warnings that it throws. I'm reading this doc, and am doing this in my code:
(I also tried:)
but still get warnings when reading EXR images:
Is there a way I can disable the above (or: what silly mistake am I making here?) Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @ahemberger, What you are doing should work I think, here is what I would be expecting: >>> import colour
>>> colour.utilities.filter_warnings(*[True] * 4)
>>> colour.utilities.runtime_warning('Hey!')
True
>>> colour.utilities.filter_warnings(*['default'] * 4)
>>> colour.utilities.runtime_warning('Hey!')
/Users/kelsolaar/Documents/Development/colour-science/colour/colour/utilities/verbose.py:235: ColourRuntimeWarning: Hey!
warn(*args, **kwargs)
True
>>> colour.utilities.filter_warnings(*[True] * 4)
>>> colour.read_image('/Users/kelsolaar/Downloads/Colour_Normal_Observers_sRGB_Primaries_Red_Extreme.exr')
array([[[ 1.00000000e+00, 6.24389648e-02, -5.97381592e-03],
[ 1.00000000e+00, 1.05023384e-04, 2.44975090e-05],
[ 1.00000000e+00, -3.82080078e-02, -8.62121582e-03]]], dtype=float32)
>>> colour.utilities.filter_warnings(*['default'] * 4)
>>> colour.read_image('/Users/kelsolaar/Downloads/Colour_Normal_Observers_sRGB_Primaries_Red_Extreme.exr')
/Users/kelsolaar/Documents/Development/colour-science/colour/colour/utilities/verbose.py:235: ColourUsageWarning: "OpenImageIO" related API features are not available, switching to "Imageio"!
warn(*args, **kwargs)
array([[[ 1.00000000e+00, 6.24389648e-02, -5.97381592e-03],
[ 1.00000000e+00, 1.05023384e-04, 2.44975090e-05],
[ 1.00000000e+00, -3.82080078e-02, -8.62121582e-03]]], dtype=float32) |
Beta Was this translation helpful? Give feedback.
Hi @ahemberger,
What you are doing should work I think, here is what I would be expecting: