Memory errors when using imaplib with large email attachments

Jp Calderone exarkun at intarweb.us
Tue Jul 22 10:28:42 EDT 2003


On Tue, Jul 22, 2003 at 04:53:36AM -0700, Richard Walkington wrote:
> Hello,
> 
> I'm using python to connect to an IMAP server and download mail. When
> downloading messages with large attachements (> 10MB) Python socket
> module crashes with a memory error. Is there anything I can do about
> this?

  Short of hacking on imaplib.py yourself (and then using this modified
version), I don't believe so.

  I would recommend using Twisted's IMAP support, which uses temporary files
(among other strategies) to keep memory usage within reason.

    http://www.twistedmatrix.com/

  The IMAP API is still in a very minor state of flux, but there should be
no futher changes that seriously break application code using it.

  Jp

-- 
A sad spectacle.  If they be inhabited, what a scope for misery 
and folly.  If they be not inhabited, what a waste of space.
                -- Thomas Carlyle, looking at the stars





More information about the Python-list mailing list