Python 2.3.2 and also 18/11/03 CVS; Windows XP. If _checkquote is passed the empty string, it raises and exception (because it tries to get an index into the string). The easiest way to reproduce this is: >>> import imaplib >>> i = imaplib.IMAP4('server.name') >>> i.login("username", "password") >>> i.select("") [Traceback here] While it's unlikely that there's a folder called "", this should really give the 'invalid folder name' error, rather than an exception. The attached diff fixes this, simply by checking for the empty string in _checkquote.
The patch is more trouble than it's worth because it's hopelessly out of date. I think this needs a new patch if it's still relevant or else it should be closed.