This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: urllib raises exception with string in 'errno' attribute
Type: behavior Stage: resolved
Components: Versions: Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: errno and strerror attributes incorrectly set on socket errors wrapped by urllib
View: 6471
Assigned To: Nosy List: denkoren, r.david.murray
Priority: normal Keywords:

Created on 2013-07-29 16:01 by denkoren, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
pyerror.py denkoren, 2013-07-29 16:01 Bug demonstration code example.
Messages (2)
msg193878 - (view) Author: Denis (denkoren) Date: 2013-07-29 16:01
On 'connection refused' error urllib creates IOError with wrong arguents:
args ('socket error', error(<os-dependent-number>, 'Connection refused'))

It results to dirty hacks in Python code like
  'if e.errno == "socket error": ...'

instead of traditional

  'id e.errno == errno.ECONNREFUSED: ...'
msg193883 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-07-29 17:16
This is a duplicate of issue 6471, which we really do need to fix.  But there are backward compatibility concerns with fixing it in 2.7, I'm afraid.
History
Date User Action Args
2022-04-11 14:57:48adminsetgithub: 62787
2013-07-29 17:16:38r.david.murraysetstatus: open -> closed

superseder: errno and strerror attributes incorrectly set on socket errors wrapped by urllib

nosy: + r.david.murray
messages: + msg193883
resolution: duplicate
stage: resolved
2013-07-29 16:01:57denkorencreate