question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Filter (mute/disable) specific warnings

See original GitHub issue

How 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:closed
  • Created 6 years ago
  • Comments:35 (34 by maintainers)

github_iconTop GitHub Comments

1reaction
cbrnrcommented, Dec 5, 2017

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 a warning log level, but these warnings spam my output which might make me miss important warnings.

0reactions
larsonercommented, May 16, 2022

@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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found