R. David Murray added the comment:
This was fixed in issue 4471 by Antoine when he added some tests that call
login. He fixed it by changing _quote to work with strings. Per the
discussion here I'm not sure this is the best fix, but until someone reports a
bug with it it we may as well let
Marcin Bachry added the comment:
Ok, it think it's good to leave internal _quote() function operating on
bytes and convert password argument in login(). The method now works
with both str and bytes as arguments.
--
keywords: +patch
Added file: http://bugs.python.org/file14752/imaplib-lo
STINNER Victor added the comment:
> It seems most IMAP4 methods accept str as arguments right now (I
> checked: list, lsub, myrights, select, status, search, fetch) and
> login() is a sole exception. I know the protocol is mostly ascii only,
> but still having possibility of using str in the API
Marcin Bachry added the comment:
It seems most IMAP4 methods accept str as arguments right now (I
checked: list, lsub, myrights, select, status, search, fetch) and
login() is a sole exception. I know the protocol is mostly ascii only,
but still having possibility of using str in the API feels co
STINNER Victor added the comment:
> I can't find any reference to needing to encode information
> myself for the login procedure. Is there some other
> documentation you are referring to?
Exactly, the Python imaplib documentation should be fixed (the doc, not
the code).
--
_
Eric added the comment:
I checked the latest documentation for 3.1.1
(http://docs.python.org/3.1/library/imaplib.html), but I can't find any
reference to needing to encode information myself for the login
procedure. Is there some other documentation you are referring to?
In any case, the error
STINNER Victor added the comment:
IMAP4 protocol uses bytes, not characters. There is no "standard
charset", so you have to encode (manually) your login and password as
bytes. login method prototype:
IMAP4.login(login: bytes, password: bytes)
You server may use UTF-8, but another server may u
R. David Murray added the comment:
See issue 1210 for background on the imaplib bytes/string issues.
A quick glance at the imaplib code leaves me confused. _checkquote,
for example, appears to be mixing string comparisons and byte
comparisons. Issue 1210 says imaplib _command should only quot
New submission from Eric :
using imaplib IMAP4_SSL, would fail at login due to TypeError, implicit
conversion from bytes object to string around line 1068 involving
function "_quote".
My fix:
def _quote(self, arg):
#Could not implicitly convert to bytes object to string
arg = a