Filter (mute/disable) specific warnings
See original GitHub issueHow can I filter a specific warning I don’t want to see? The problem is that warnings go through warnings
and the logging
module. Specifically, I want to mute the warning that my ICA files do not follow MNE naming conventions. I can mute the warning (in fact, I want to mute all warnings related to MNE naming conventions) like this:
warnings.filterwarnings("ignore", ".*not conform to MNE naming conventions.*")
But the logging warning is still there. What is the recommended way to turn off specific warnings in MNE?
Issue Analytics
- State:
- Created 6 years ago
- Comments:35 (34 by maintainers)
Top Results From Across the Web
How to get rid of specific warning messages in python while ...
If Scipy is using the warnings module, then you can suppress specific warnings. Try this at the beginning of your program:
Read more >warnings — Warning control — Python 3.11.1 documentation
The warnings filter controls whether warnings are ignored, displayed, or turned into errors (raising an exception). Conceptually, the warnings filter maintains ...
Read more >Suppress compiler warnings - Visual Studio - Microsoft Learn
In the Disable Specific Warnings box, specify the error codes of the warnings that you want to suppress, separated by a semicolon.
Read more >Suppress Warnings In Python: All You Need To Know
You can use the 'filterwarnings()' function from the warnings module and set 'default' as a parameter to re-enable warnings.
Read more >How to Filter, Block, and Report Harmful Content on Social ...
To mute their profile: Click the “Following” button with the dropdown arrow > Select “Mute” > Select either “Stories,” “Posts,” or both. Block...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The question is how are standard file name conventions enforced? I prefer to use
*_ica.fif
instead of*-ica.fif
because all my files are separated by underscores. Does anything stop working if I don’t follow the convention? If not, this message should be an info and not a warning. And yes, I use awarning
log level, but these warnings spam my output which might make me miss important warnings.@JJKK1313 if you can make a minimal script to reproduce the issue someone can take a look. As it stands, it’s unclear how/why you’re experiencing problems!