2

http://docs.python.org/library/imaplib.html states that:

exception IMAP4.error
Exception raised on any errors. The reason for the exception is passed to the constructor as a string.

What does "exception is passed to the constructor as a string" mean? What would the code look like that can print the reason.

2 Answers 2

2

Just use print str(exception).

Sign up to request clarification or add additional context in comments.

Comments

1

You can specify the reason when constructing the exception yourself, and put it into a variable when catching the exception.

try:
    raise imaplib.IMAP4.error('Some exception')
except imaplib.IMAP4.error, error:
    print error

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.