Search code examples
pythonsuppress-warnings

How to disable Python warnings?


I am working with code that throws a lot of (for me at the moment) useless warnings using the warnings library. Reading (/scanning) the documentation I only found a way to disable warnings for single functions. But I don't want to change so much of the code.

Is there a flag like python -no-warning foo.py?

What would you recommend?


Solution

  • There's the -W option.

    python -W ignore foo.py