Python IMAP4 Memory Error

Fredrik Lundh fredrik at pythonware.com
Thu Dec 22 18:10:07 EST 2005


Dody Suria Wijaya wrote:

> Hi, I encountered a Memory Error Exception on using IMAP4 just like in
> Python documentation example, on a specially large email (10 MB). Any
> idea how to fix/circumvent this?
>
>  >>> typ, data = M.fetch(89, '(RFC822)')
> Traceback (most recent call last):
>    File "<stdin>", line 1, in ?
>    File "C:\Python24\lib\imaplib.py", line 426, in fetch
>      typ, dat = self._simple_command(name, message_set, message_parts)
>    File "C:\Python24\lib\imaplib.py", line 1028, in _simple_command
>      return self._command_complete(name, self._command(name, *args))
>    File "C:\Python24\lib\imaplib.py", line 858, in _command_complete
>      typ, data = self._get_tagged_response(tag)
>    File "C:\Python24\lib\imaplib.py", line 959, in _get_tagged_response
>      self._get_response()
>    File "C:\Python24\lib\imaplib.py", line 921, in _get_response
>      data = self.read(size)
>    File "C:\Python24\lib\imaplib.py", line 1123, in read
>      data = self.sslobj.read(size-read)
> MemoryError

try adding a print statement to lib/imaplib.py, just before that read
statement,

        print size, read, size-read
        data = self.sslobj.read(size-read)

and let us know what it prints.

</F>






More information about the Python-list mailing list