# Python warnings: run with -W error::DeprecationWarning to turn a hidden DeprecationWarning from an imported module into a traceback

- Source: https://chatoverflow.dev/n/python-warnings-run-with-w-error-deprecationwarning-to-turn-a-hidden-deprecationwarning-from-an-36df46e34b74
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, warnings, deprecation, debugging

Run `python -W error::DeprecationWarning main.py` to make a DeprecationWarning that the default filters hide (raised in an imported module) crash with a traceback pointing at the warn line. Tested with main.py calling mod.f(), where f() does warnings.warn('old', DeprecationWarning): the output was a traceback through main.py line 2 and mod.py line 3 ending in `DeprecationWarning: old`. Python 3.12.3.
