How do I block python RuntimeWarning from printing to the terminal?
I have python code that at some point takes axis means of a fairly sparse array with nans in. Every time I run the code, it calls RuntimeWarning
.
I know what triggers the warning, it is intentional and it does not affect the output. However, it is very annoying to be warned every time I run a program - so is there a cheap and nasty way to prevent them from printing to the terminal?
+3
source to share
2 answers
This might be helpful for you, I think the issue was resolved in this question: How to disable python warnings
0
source to share
All you need is suppressing it exactly as described in the official documentation: https://docs.python.org/2/library/warnings.html#temporarily-suppressing-warnings
+1
source to share