imbox icon indicating copy to clipboard operation
imbox copied to clipboard

too many values to unpack (expected 2)

Open malohtie opened this issue 5 years ago • 2 comments

I get this error when trying to get some emails

with Imbox('imap.mail.yahoo.com', username='xxxxxxx', password='xxxxx', ssl=True, ssl_context=None, starttls=False) as imbox:
  File "C:\Users\maloh\AppData\Local\Programs\Python\Python37-32\lib\site-packages\imbox\messages.py", line 39, in _fetch_email_list
    yield uid, self._fetch_email(uid)
  File "C:\Users\maloh\AppData\Local\Programs\Python\Python37-32\lib\site-packages\imbox\messages.py", line 28, in _fetch_email
    parser_policy=self.parser_policy)
  File "C:\Users\maloh\AppData\Local\Programs\Python\Python37-32\lib\site-packages\imbox\parser.py", line 139, in fetch_email_by_uid
    raw_headers, raw_email = data[0]
ValueError: too many values to unpack (expected 2)

my code

all_inbox_messages = imbox.messages()
	print("Got all inbox msgs")
	print("Getting ...")
	for uid, message in all_inbox_messages:
		if hasattr(message, 'message_id') and len(message.message_id) > 0:
			print(message.sent_from[0]['email'] + "," + message.message_id)
			emails.append(message.sent_from[0]['email'] + "," + message.message_id)

malohtie avatar Oct 28 '19 15:10 malohtie

This happens when you try to receive deleted emails. imbox.messages(folder='INBOX') will solve this issue.

vasia123 avatar Jan 25 '20 09:01 vasia123

I notice it also happen when the connection is poor

malohtie avatar Jan 25 '20 13:01 malohtie