[issue13211] urllib2.HTTPError does not have 'reason' attribute.

Jason R. Coombs report at bugs.python.org
Mon Nov 7 22:38:14 CET 2011


Jason R. Coombs <jaraco at jaraco.com> added the comment:

My initial instinct was to agree - the status code is useful. However, in looking at the FTP code, it sometimes just sets other objects (socket.error for example) as the 'reason'. The docs say 'reason' is a string or another exception.

I'm tempted to leave it as is. This fix is mainly to provide a reasonable value for .reason. The __str__ and .code are already exposed, so to create a reason with a code would create yet another string representation of the error which is different from every other representation already present.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13211>
_______________________________________


More information about the Python-bugs-list mailing list