[issue2118] smtplib.SMTP() raises socket.error rather than SMTPConnectError
New submission from stranger4good: smtplib.SMTP() raises socket.error rather than SMTPConnectError just try this on a non-responding address >>> srv=smtplib.SMTP('192.168.13.22') Traceback (most recent call last): File "", line 1, in File "c:\python25\lib\smtplib.py", line 244, in __init__ (code, msg) = self.connect(host, port) File "c:\python25\lib\smtplib.py", line 311, in connect (code, msg) = self.getreply() File "c:\python25\lib\smtplib.py", line 352, in getreply line = self.file.readline() File "C:\Python25\lib\socket.py", line 346, in readline data = self._sock.recv(self._rbufsize) socket.error: (10054, 'Connection reset by peer') -- components: Library (Lib) messages: 62416 nosy: stranger4good severity: normal status: open title: smtplib.SMTP() raises socket.error rather than SMTPConnectError type: behavior versions: Python 2.5 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2118> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2118] smtplib.SMTP() raises socket.error rather than SMTPConnectError
stranger4good added the comment: Not in so many words, but yes it does I cite: exception SMTPException Base exception class for all exceptions raised by this module ... exception SMTPConnectError Error occurred during establishment of a connection with the server. ... Note the word "all". So, at least one should be able to catch SMTPException, but it is not the case Just my 2 cents. I do believe it is a great piece of work. Regards --- Christian Heimes <[EMAIL PROTECTED]> wrote: > > Christian Heimes added the comment: > > Why is this a bug? Do the docs promise that smtplib > only raises > SMTPConnectError? > > -- > nosy: +tiran > priority: -> normal > > __ > Tracker <[EMAIL PROTECTED]> > <http://bugs.python.org/issue2118> > __ > Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2118> __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com