warnings module writes warning messages to the
import warnings warnings.warn("This is a drill!")
The output warning also contains a line number:
warn.py:3: UserWarning: This is a drill! warnings.warn("This is a drill!")
Python has an option to stop with an error as soon as a warning occurs:
python -W error warnme.py
I am a professional Python trainer, developer and author based in Berlin. I believe everybody can learn programming.
Contact me via:
+49 176 3052 4691
Your tips helped me a lot with designing the workshop and then to make it run smoothly!
Joanna Kasprzak, UAM Poznan