Warning Framework
The warning filter
- Handling of each warning message can be modified
- Warning filter specifies actions for individual warnings
- Actions:
'error' Turn warning into exception
'ignore' Ignore the warning
'always' Always print the warning message
'once' Print warning message only once
'default' Print warning message once for location where
warning message is issued
'module' Print warning message once for each module
where warning message is issued
- warnings.filterwarnings(action [, message [, category [, module [, lineno]]]])
action = One of the above actions
message = Regular expression matching warning message
category = DeprecationWarning, SyntaxWarning, etc.
module = Regular expression matching module name
lineno = Line number matching location of warning
|