Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82300
| Subject | Getting errors from Imaplib - reloaded |
|---|---|
| From | Beatrix Willius from Moth Software <mail@beatrixwillius.de> |
| Date | 2014-12-10 17:41 +0100 |
| References | <4B0DF114-E705-47B3-9815-003899F174CE@beatrixwillius.de> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16820.1418231649.18130.python-list@python.org> (permalink) |
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 comp.lang.python | Previous | Next | Find similar | Unroll thread
Getting errors from Imaplib - reloaded Beatrix Willius from Moth Software <mail@beatrixwillius.de> - 2014-12-10 17:41 +0100
csiph-web