By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,564 Members | 933 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,564 IT Pros & Developers. It's quick & easy.

Re: How do I create user-defined warnings?

P: n/a
2008/6/18 Clay Hobbs <cl**@lakeserv.net>:
I already know how to make user-defined exceptions, like this one:

class MyException(Exception):
pass

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):
pass

And it behaves like a normal error. Please help me, I can't figure out
what I'm doing wrong.
Use 'warnings' module.
http://docs.python.org/lib/module-warnings.html
>
--
Ratfink

--
http://mail.python.org/mailman/listinfo/python-list


--
Wbr, Andrii Mishkovskyi.

He's got a heart of a little child, and he keeps it in a jar on his desk.
Jun 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.