IMAP Checking Folder Size

Donn Cave donn at u.washington.edu
Mon Mar 20 13:57:49 EST 2006


In article <dvmh9e$ev0o$1 at netnews.upenn.edu>,
 Kevin F <neurogasm at gmail.com> wrote:
> I'm trying to use the following code to get my remote server's folder 
> size information.  Unfortunately, i'm getting the error:
> 
> 
> 
> Traceback (most recent call last):
>    File "/Life/School/Homework/Spring 2006/OPIM 
> 399/Tutorial/IMAP/mailboxsize.py", line 23, in -toplevel-
>      number_of_messages_all += int(number_of_messages[0])
> ValueError: invalid literal for int(): The requested item could not be 
> found.

...
>      # Select the desired folder
>      result, number_of_messages  = M.select(mailbox, readonly=1)
>      number_of_messages_all += int(number_of_messages[0])

A general observation about imaplib, the caller usually has
some analysis to do on the returned data.  For example, you
have to check that `result' value, before you can assume that
you got the data you asked for.  I would suggest that you print
these values out somewhere, it will put you in a position where
you can probably answer your question better than we can.

   Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list