imbox
imbox copied to clipboard
error: command SEARCH illegal in state AUTH, only allowed in states SELECTED
error Traceback (most recent call last)
/usr/local/lib/python2.7/dist-packages/imbox/init.pyc in fetch_list(self, **kwargs) 32 33 def fetch_list(self, **kwargs): ---> 34 uid_list = self.query_uids(**kwargs) 35 36 for uid in uid_list:
/usr/local/lib/python2.7/dist-packages/imbox/init.pyc in query_uids(self, **kwargs) 20 query = build_search_query(**kwargs) 21 ---> 22 message, data = self.connection.uid('search', None, query) 23 return data[0].split() 24
/usr/lib/python2.7/imaplib.pyc in uid(self, command, *args) 756 "only allowed in states %s" % 757 (command, self.state, --> 758 ', '.join(Commands[command]))) 759 name = 'UID' 760 typ, dat = self._simple_command(name, command, *args)
error: command SEARCH illegal in state AUTH, only allowed in states SELECTED
The same problem
select folder first, then query
self.conn.connection.select(TRASH)
messages = self.conn.messages(TRASH)
I hit the same problem, and it appears to only occur when I've used an incorrect folder name.
I suspect it'd be worth checking if a supplied folder name appears in imbox.folders()
and raising a helpful exception or similar
(http://stackoverflow.com/q/5161053/928098 and http://stackoverflow.com/a/5161338/928098 were insightful!)