message of Exception

Discussion in 'Python' started by Steven Woody, Jan 7, 2009.

  1. Steven Woody

    Steven Woody Guest

    Hi,

    I am trying define an Exception as below:

    class MyError(Exception):
    def __init__(self, message):
    self.message = message

    And, I expect that when I raise a MyError as
    raise MyError, "my message"
    the python should print a line such as
    MyError: my message

    But I did not get that, I just got:
    ...
    MyError

    I guess I had made something wrong with the __init__() definition, but
    I can not find an answer in doc. Please help, thanks!

    -
    narke
     
    Steven Woody, Jan 7, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?bWc=?=
    Replies:
    1
    Views:
    2,202
    Marshal Antony
    Feb 8, 2004
  2. =?Utf-8?B?bWc=?=

    Size of e-mail message - message.Body = msgText

    =?Utf-8?B?bWc=?=, Feb 10, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    602
    Chad Z. Hower aka Kudzu
    Feb 11, 2004
  3. - Steve -
    Replies:
    0
    Views:
    733
    - Steve -
    Jul 6, 2004
  4. tshad
    Replies:
    0
    Views:
    827
    tshad
    Jan 27, 2005
  5. Replies:
    2
    Views:
    592
    sloan
    Aug 18, 2006
Loading...

Share This Page