运行结果 求解 C:\Users\何家明>1.py Traceback (most recent call last): File "C:\Users\何家明\1.py", line 6, in <module> unread_mails = imbox.messages(unread=True) File "C:\Users\何家明\AppData\Local\Programs\Python\Python38\lib\site-packages\imbox\imbox.py", line 100, in messages return messages_class(connection=self.connection, File "C:\Users\何家明\AppData\Local\Programs\Python\Python38\lib\site-packages\imbox\messages.py", line 37, in __init__ self._uid_list = self._query_uids(**kwargs) File "C:\Users\何家明\AppData\Local\Programs\Python\Python38\lib\site-packages\imbox\messages.py", line 48, in _query_uids _, data = self.connection.uid('search', None, query_) File "C:\Users\何家明\AppData\Local\Programs\Python\Python38\lib\imaplib.py", line 876, in uid raise self.error("command %s illegal in state %s, " imaplib.error: command SEARCH illegal in state AUTH, only allowed in states SELECTED
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\何家明\1.py", line 13, in <module> print('已标记为已读') File "C:\Users\何家明\AppData\Local\Programs\Python\Python38\lib\site-packages\imbox\imbox.py", line 49, in __exit__ self.logout() File "C:\Users\何家明\AppData\Local\Programs\Python\Python38\lib\site-packages\imbox\imbox.py", line 52, in logout self.connection.close() File "C:\Users\何家明\AppData\Local\Programs\Python\Python38\lib\imaplib.py", line 466, in close typ, dat = self._simple_command('CLOSE') File "C:\Users\何家明\AppData\Local\Programs\Python\Python38\lib\imaplib.py", line 1205, in _simple_command return self._command_complete(name, self._command(name, *args)) File "C:\Users\何家明\AppData\Local\Programs\Python\Python38\lib\imaplib.py", line 943, in _command raise self.error("command %s illegal in state %s, " imaplib.error: command CLOSE illegal in state AUTH, only allowed in states SELECTED