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: command SEARCH illegal in state AUTH, only allowed in states SELECTED #38

Closed
zhao-ji opened this issue Jan 13, 2015 · 3 comments · Fixed by #242
Closed

error: command SEARCH illegal in state AUTH, only allowed in states SELECTED #38

zhao-ji opened this issue Jan 13, 2015 · 3 comments · Fixed by #242

Comments

@zhao-ji
Copy link

zhao-ji commented Jan 13, 2015

error Traceback (most recent call last)
in ()
----> 1 mails.next()

/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

@liuyu121
Copy link

The same problem

@d1ffuz0r
Copy link

d1ffuz0r commented Jul 6, 2015

select folder first,
then query

self.conn.connection.select(TRASH)
messages = self.conn.messages(TRASH)

@doismellburning
Copy link

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!)

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

Successfully merging a pull request may close this issue.

4 participants