Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when fetching inbox with no unread emails with unread=True, prefetch=True #61

Open
benbaptist opened this issue Nov 2, 2015 · 1 comment

Comments

@benbaptist
Copy link

When trying to fetch for new emails with .mail(unread=True, prefetch=True) when there's no unread emails, this error is thrown. It does not appear if I don't pass unread or prefetch, but together, it happens.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/gmail/mailbox.py", line 64, in mail
    self.messages.update(self.gmail.fetch_multiple_messages(messages_dict))
  File "/usr/local/lib/python2.7/dist-packages/gmail/gmail.py", line 145, in fetch_multiple_messages
    response, results = self.imap.uid('FETCH', fetch_str, '(BODY.PEEK[] FLAGS X-GM-THRID X-GM-MSGID X-GM-LABELS)')
  File "/usr/lib/python2.7/imaplib.py", line 772, in uid
    typ, dat = self._simple_command(name, command, *args)
  File "/usr/lib/python2.7/imaplib.py", line 1087, in _simple_command
    return self._command_complete(name, self._command(name, *args))
  File "/usr/lib/python2.7/imaplib.py", line 917, in _command_complete
    raise self.error('%s command error: %s %s' % (name, typ, data))
imaplib.error: UID command error: BAD ['Could not parse command']

Sample code:

g = gmail.login("user", "pass")
inbox = g.inbox()
mail = inbox.mail(unread=True, prefetch=True)

I'm not 100% sure if this is a problem on my end/something I'm doing wrong, or on the module's end. Hopefully it is easily fixable!

@johnmaguire
Copy link

I couldn't get unread=True to work, so I used query="is:unread" and then got the error described in this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants