[New-bugs-announce] [issue6734] Imap lib implicit conversion from bytes to string

Eric report at bugs.python.org
Wed Aug 19 15:18:00 CEST 2009

New submission from Eric <surprising42 at gmail.com>:

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 = arg.encode('utf-8') #added this line to solve problem
        arg = arg.replace(b'\\', b'\\\\')
        arg = arg.replace(b'"', b'\\"')

        return b'"' + arg + b'"'

components: Library (Lib)
files: imaplib.py
messages: 91729
nosy: surprising42
severity: normal
status: open
title: Imap lib implicit conversion from bytes to string
type: behavior
versions: Python 3.1
Added file: http://bugs.python.org/file14743/imaplib.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list