Re: How do I create user-defined warnings?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andrii V. Mishkovskyi

    Re: How do I create user-defined warnings?

    2008/6/18 Clay Hobbs <clay@lakeserv. net>:
    I already know how to make user-defined exceptions, like this one:
    >
    class MyException(Exc eption):
    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(Warni ng):
    pass
    >
    And it behaves like a normal error. Please help me, I can't figure out
    what I'm doing wrong.
    Use 'warnings' module.
    Source code: Lib/warnings.py Warning messages are typically issued in situations where it is useful to alert the user of some condition in a program, where that condition (normally) doesn’t warrant...



    --
    Wbr, Andrii Mishkovskyi.

    He's got a heart of a little child, and he keeps it in a jar on his desk.
Working...