import imaplib connection = imaplib.IMAP4_SSL("imap.gmail.com", 993) connection.login("login", "password") connection.select('INBOX') _, response = connection.search(None, criteria) print(response ) 

In Python 3.6.6, it works fine. But I need to focus on Python 2.6.6. However, the following error appears in it:

Traceback (most recent call last): File "D: \ Sergienko \ Downloads \ t.py", line 5, in _, response = connection.search (None, 'SINCE "01-Feb-2017" BEFORE "01-Aug -2018 "') File" C: \ Program Files \ Python26 \ lib \ imaplib.py ", line 620, in search typ, dat = self._simple_command (name, * criteria) File" C: \ Program Files \ Python26 \ lib \ imaplib.py ", line 1060, in _simple_command return self._command_complete (name, self._command (name, * args)) File" C: \ Program Files \ Python26 \ lib \ imaplib.py ", line 895, in _command_complete raise self.error ('% s command error:% s% s'% (name, typ, data)) error: SEARCH command error: BAD ['Could not parse command']

What's the matter? How to do the same in Python 2.6.6?

    0