63
Monkeypatch warnings.showwarning() with your own custom function, e.g. like this:
import warnings
def my_warning(message, category, filename, lineno, file=None, line=None):
print(message)
warnings.showwarning = my_warning
Note that the manual itself recommends monkeypatching this:
You may replace this function with any callable by assigning to
warnings.showwarning.