Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82300 > unrolled thread
| Started by | Beatrix Willius from Moth Software <mail@beatrixwillius.de> |
|---|---|
| First post | 2014-12-10 17:41 +0100 |
| Last post | 2014-12-10 17:41 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Getting errors from Imaplib - reloaded Beatrix Willius from Moth Software <mail@beatrixwillius.de> - 2014-12-10 17:41 +0100
| From | Beatrix Willius from Moth Software <mail@beatrixwillius.de> |
|---|---|
| Date | 2014-12-10 17:41 +0100 |
| Subject | Getting errors from Imaplib - reloaded |
| Message-ID | <mailman.16820.1418231649.18130.python-list@python.org> |
Hi,
thanks to your help I can get traceback errors for the imaplib. But what about accessing direct imap errors? In the following part of my script I can't select the not-deleted mails for some reason. But how do I access the error? The debugger goes to the exception line but OSError.strerror doesn't have anything. And print(imaplib.IMAP4.error) only gives me <class 'imaplib.IMAP4.error'> as result.
import imaplib
host = "xxx"
username = "bla"
password = "blub"
mailbox = "\"Ablage.Kunden\""
imap_connection = imaplib.IMAP4(host)
result, data = imap_connection.login(username, password)
result, data = imap_connection.select(mailbox, True)
try:
result, messages_data = imap_connection.search(None, "NOT DELETED")
print('okay')
except (imaplib.IMAP4.error, OSError):
#print(OSError.strerror)
#print(imaplib.IMAP4.error)
print('xxxerrorxxx: select mails exception')
imap_connection.logout()
Mit freundlichen Grüßen/Regards
Trixi Willius
http://www.mothsoftware.com
Mail Archiver X: The email archiving solution for professionals
Back to top | Article view | comp.lang.python
csiph-web