RobFisher/mailshare — Issue #8: poll_emails sometimes exits with socket error
Author: RobFisher
Created: 2011-11-22 12:38:02+00:00
State: open
Labels: bug

Do this:

$ python manage.py shell
>>> import mailshareapp.process_emails
>>> mailshareapp.process_emails.poll_emails(True)

This works for many days, until:

```
Traceback (most recent call last):
File "", line 1, in
File "/home/fisherr/mailshare/mailshareapp/process_emails.py", line 151, in poll_emails
messages = poll_imap_email.fetch_messages(10, mail_file, True)
File "/home/fisherr/mailshare/mailshareapp/poll_imap_email.py", line 45, in fetch_messages
typ, response = server.expunge()
File "/usr/lib/python2.6/imaplib.py", line 421, in expunge
typ, dat = self._simple_command(name)
File "/usr/lib/python2.6/imaplib.py", line 1060, in _simple_command
return self._command_complete(name, self._command(name, *args))
File "/usr/lib/python2.6/imaplib.py", line 890, in _command_complete
raise self.abort('command: %s => %s' % (name, val))
abort: command: EXPUNGE => socket error: EOF
```

The only way to get it working again seems to be to CTRL-D out of Python and re-run.