[issue1210] imaplib does not run under Python 3

Raghuram Devarakonda report at bugs.python.org
Mon Nov 12 22:42:33 CET 2007


Raghuram Devarakonda added the comment:

Index: Lib/imaplib.py
===================================================================
--- Lib/imaplib.py      (revision 58956)
+++ Lib/imaplib.py      (working copy)
@@ -228,7 +228,7 @@
         self.port = port
         self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         self.sock.connect((host, port))
-        self.file = self.sock.makefile('rb')
+        self.file = self.sock.makefile('r', encoding='ASCII', newline='')
 
 
     def read(self, size):

-------------

This patch fixes the issue but I am not entirely sure that it is
correct. I quickly looked at IMAP RFC and there does seem to be spec for
CHARSET in which case, that will have to be used instead of ASCII. It
requires more research and imap knowledge which I can't claim.

As for the tests, we need a imap server to connect to. Perhaps, google
wouldn't mind being used for this purpose?

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1210>
__________________________________


More information about the Python-bugs-list mailing list