Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #82300

Getting errors from Imaplib - reloaded

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <mail@beatrixwillius.de>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.026
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'result,': 0.07; 'subject:Getting': 0.07; 'archiving': 0.09; 'debugger': 0.09; 'password)': 0.09; 'true)': 0.09; 'try:': 0.09; 'reason.': 0.16; 'exception': 0.16; 'skip:# 20': 0.16; 'result.': 0.19; 'select': 0.22; 'import': 0.22; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'host': 0.29; "doesn't": 0.30; 'errors': 0.30; 'skip:( 20': 0.30; 'gives': 0.31; 'username': 0.31; 'subject:from': 0.34; "can't": 0.35; 'except': 0.35; 'received:84': 0.35; 'but': 0.35; 'accessing': 0.36; 'thanks': 0.36; 'hi,': 0.36; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'how': 0.40; 'header:Message-Id:1': 0.63; 'direct': 0.67; 'mailbox': 0.68; 'anything.': 0.68; 'from:addr:mail': 0.83; '"not': 0.84; 'received:212.162': 0.84; 'mails': 0.89
Content-Type text/plain; charset=utf-8
Mime-Version 1.0 (Mac OS X Mail 8.0 \(1990.1\))
Subject Getting errors from Imaplib - reloaded
From Beatrix Willius from Moth Software <mail@beatrixwillius.de>
In-Reply-To <4B0DF114-E705-47B3-9815-003899F174CE@beatrixwillius.de>
Date Wed, 10 Dec 2014 17:41:22 +0100
Content-Transfer-Encoding quoted-printable
References <4B0DF114-E705-47B3-9815-003899F174CE@beatrixwillius.de>
To python-list@python.org
X-Mailer Apple Mail (2.1990.1)
X-Info valid message
X-Info original Date
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16820.1418231649.18130.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1418231649 news.xs4all.nl 2855 [2001:888:2000:d::a6]:58427
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:82300

Show key headers only | View raw


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


Thread

Getting errors from Imaplib - reloaded Beatrix Willius from Moth Software <mail@beatrixwillius.de> - 2014-12-10 17:41 +0100

csiph-web