jazzband / imaplib2

Fork of Piers Lauder's imaplib2 library for Python.
https://imaplib2.readthedocs.io/
MIT License
33 stars 29 forks source link

Issue with windows select.poll replacement #9

Open ChristofferNorgaard opened 3 years ago

ChristofferNorgaard commented 3 years ago

When trying to use imaplib2.py3 for python 3 on windows I get the following error.

14:55.51 MainThread imaplib2 version 3.05
  14:55.51 MainThread imaplib2 debug level 5, buffer level 3
  14:55.60 MainThread connected to imap.gmail.com on port 993
  14:55.60 imap.gmail.com writer starting
  14:55.60 imap.gmail.com reader starting using select
  14:55.60 MainThread _request_push(continuation, welcome, {}) = b'JEEP0'
  14:55.60 MainThread welcome:b'JEEP0'.ready.wait
  14:55.63 imap.gmail.com reader select => [1640], [], []
  14:55.63 imap.gmail.com reader rcvd 67
  14:55.63 imap.gmail.com reader < '* OK Gimap ready for requests from 89.212.201.191 u4mb45497943wmg\r\n'
  14:55.70 imap.gmail.com handler starting
Exception in thread imap.gmail.com handler:
Traceback (most recent call last):
  File "C:\Users\Jakob\AppData\Local\Programs\Python\Python39\lib\threading.py", line 950, in _bootstrap_inner
    self.run()
  File "C:\Users\Jakob\AppData\Local\Programs\Python\Python39\lib\threading.py", line 888, in run
    self._target(*self._args, **self._kwargs)
  File "F:\documents\coding_projects\2019\forwarding\v2\forwardingV2\imaplib3.py", line 1735, in _handler
    typ, val = line
ValueError: too many values to unpack (expected 2)

After a day of troubleshooting I think the source of the problem is _reader function. It is (if I understand correctly) defined 2 ways - if hasattr(select_module, "poll") for linux or the other one for windows. So I tried the same code on WSL and it worked fine.

This leads me to believe that there is some error in the version of _reader for windows (the one not using poll).