Cannot connect to IMAP server in Python 3.2

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Apr 5 08:25:19 EDT 2012


On Thu, 05 Apr 2012 12:16:09 +0000, Steven D'Aprano wrote:

> On Thu, 05 Apr 2012 00:21:31 -0700, Steve Howell wrote:

>> Why are you changing the invocation between versions of Python?
> 
> Because imaplib.IMAP4_SSL apparently no longer exists in Python 3.
> 
>>>> server = imaplib.IMAP4_SSL('xxxxx')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> AttributeError: 'module' object has no attribute 'IMAP4_SSL'

Wait a minute...


IMAP4_SSL is documented as existing in Python 3. And when I run Python 
3.2 on a Centos machine, instead of Debian, it includes IMAP4_SSL which 
works fine.


[steve at ando ~]$ python3.2
Python 3.2.2 (default, Mar  4 2012, 10:50:33)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
py> import imaplib
py> server = imaplib.IMAP4_SSL('xxxxx')
py> server
<imaplib.IMAP4_SSL object at 0xb7b8632c>


So there's something screwy going on here. Why does my Python 3.2 on 
Debian not include IMAP4_SSL, but Python 2.6 does?


<raises eyebrow>


-- 
Steven



More information about the Python-list mailing list