Getting errors from Imaplib

Chris Angelico rosuav at gmail.com
Sun Nov 30 15:11:59 EST 2014


On Mon, Dec 1, 2014 at 1:42 AM, Beatrix Willius from Moth Software
<mail at beatrixwillius.de> wrote:
> no, pinging Yahoo doesn't work. But this is an additional problem - perhaps I tested too often. This is one of my accounts for Imap testing and I only copied the value from Mail.
>
> For getting the error back this doesn't really matter.

I'm not sure what you mean here. There are two ways I could see this
being handled:

1) A network connection failure is fundamentally different from an
auth problem. That's what you're currently seeing; only auth problems
are caught.

2) Network failures and auth problems should be dealt with the same
way. Change one line of code:
except (imaplib.IMAP4.error, OSError):

Now it'll cope with OSError the same way it copes with IMAP errors.

Does that answer your question?

ChrisA



More information about the Python-list mailing list