diff -r b5fb268b7f04 roundup/anypy/ssl_.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/roundup/anypy/ssl_.py Tue Jan 04 17:56:48 2022 -0500 @@ -0,0 +1,6 @@ +try: + # Python 3+ + from ssl import SSLError +except (ImportError, AttributeError): + # Python 2.5-2.7 + from socket import sslerror as SSLError diff -r b5fb268b7f04 roundup/mailgw.py --- a/roundup/mailgw.py Tue Jan 04 16:31:04 2022 -0500 +++ b/roundup/mailgw.py Tue Jan 04 17:56:48 2022 -0500 @@ -112,6 +112,7 @@ from roundup.hyperdb import iter_roles from roundup.anypy.strings import StringIO, b2s, u2s import roundup.anypy.random_ as random_ +import roundup.anypy.ssl_ as ssl_ try: import gpg, gpg.core, gpg.constants, gpg.constants.sigsum @@ -1373,7 +1374,7 @@ else: self.logger.debug('Trying server %r without ssl' % server) server = imaplib.IMAP4(server) - except (imaplib.IMAP4.error, socket.error, socket.sslerror): + except (imaplib.IMAP4.error, socket.error, ssl_.SSLError): self.logger.exception('IMAP server error') return 1 @@ -1415,7 +1416,7 @@ finally: try: server.expunge() - except (imaplib.IMAP4.error, socket.error, socket.sslerror): + except (imaplib.IMAP4.error, socket.error, ssl_.SSLError): pass server.logout()