Warning Framework

Warning filter examples

     # Ignore all deprecation warnings
     warnings.filterwarnings('ignore','.*',DeprecationWarning)
     warnings.filterwarnings('ignore', category=DeprecationWarning)
     
     # Ignore deprecation warnings created by this module
     warnings.filterwarnings('ignore',DeprecationWarning,module=__name__)
     
     # Turn SyntaxWarnings into exceptions
     warnings.filterwarnings('error',SyntaxWarning)

-Waction:message:category:module:lineno option

     python -Wignore::DeprecationWarning
     python -Wignore::DeprecationWarning:foobar
     python -Werror::SyntaxWarning
     python -Wignore          # Ignore all warnings
     python -Werror           # Turn all warnings into errors
<<< O'Reilly OSCON 2001, New Features in Python 2, Slide 37
July 26, 2001, beazley@cs.uchicago.edu
>>>