Author gundlach
Recipients chris.stawarz, facundobatista, giampaolo.rodola, gundlach, jafo, janssen, jcea, orsenthil, pitrou
Date 2012-06-28.15:56:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I recently started getting what appears to be this bug in 2.6.6 and 2.7.3 when connecting to Google.

My script does this:

  while True:
    get an IMAP connection to Google, if our old one timed out
    fetch unread messages.  if any:
      make an SMTP connection to Google and send some emails 
      mark the unread messages as read
    sleep 10 seconds

It used to run fine on 2.6.  I'm assuming something changed at Google, because it started hanging, whether in 2.6 or 2.7.  Here's the stack trace when I eventually press Ctrl-C:

 File "./", line 21, in loop
    the_emails = list(emails.messages('(UNSEEN)'))
  File "./", line 129, in messages
    for chunk in chunks_of_length(32, messages):
  File "./", line 9, in chunks_of_length
    for item in iterable:
  File "./", line 90, in email_messages
    m = open_mailbox(label, readonly=True)
  File "./", line 30, in open_mailbox
    m = imaplib.IMAP4_SSL('', 993)
  File "/usr/lib64/python2.6/", line 1138, in __init__
    IMAP4.__init__(self, host, port)
  File "/usr/lib64/python2.6/", line 163, in __init__, port)
  File "/usr/lib64/python2.6/", line 1150, in open
    self.sslobj = ssl.wrap_socket(self.sock, self.keyfile, self.certfile)
  File "/usr/lib64/python2.6/", line 338, in wrap_socket
  File "/usr/lib64/python2.6/", line 120, in __init__
  File "/usr/lib64/python2.6/", line 279, in do_handshake

FWIW, for the last couple of days my script is *not* hanging, so perhaps Google changed something on their end, avoiding the Python bug.

Should this Issue be reopened or should I file a new Issue?
Date User Action Args
2012-06-28 15:56:03gundlachsetrecipients: + gundlach, facundobatista, jafo, jcea, janssen, orsenthil, pitrou, giampaolo.rodola, chris.stawarz
2012-06-28 15:56:03gundlachsetmessageid: <>
2012-06-28 15:56:03gundlachlinkissue1251 messages
2012-06-28 15:56:02gundlachcreate