How do I create user-defined warnings?
Andrii V. Mishkovskyi
mishok13 at gmail.com
Wed Jun 18 09:31:34 CEST 2008
2008/6/18 Clay Hobbs <clay at lakeserv.net>:
> I already know how to make user-defined exceptions, like this one:
> class MyException(Exception):
> But for a module I'm making, I would like to make a warning (so it just
> prints the warning to stderr and doesn't crash the program). I have
> tried this:
> class MyWarning(Warning):
> And it behaves like a normal error. Please help me, I can't figure out
> what I'm doing wrong.
Use 'warnings' module.
Wbr, Andrii Mishkovskyi.
He's got a heart of a little child, and he keeps it in a jar on his desk.
More information about the Python-list