mirror of
https://github.com/powerline/powerline.git
synced 2025-04-08 19:25:04 +02:00
Catch the correct imaplib exception
This commit is contained in:
parent
a3600158de
commit
3f2ce0a570
@ -241,7 +241,7 @@ def email_imap_alert(username, password, server='imap.gmail.com', port=993, fold
|
||||
mail.login(username, password)
|
||||
rc, message = mail.status(folder, "(UNSEEN)")
|
||||
unread_count = re.search("UNSEEN (\d+)", message[0]).group(1)
|
||||
except (imaplib.error, AttributeError):
|
||||
except (imaplib.IMAP4.error, AttributeError):
|
||||
return None
|
||||
if not unread_count:
|
||||
return None
|
||||
|
Loading…
x
Reference in New Issue
Block a user