Irit Katriel added the comment:
Reproduced on 3.11:
>>> from urllib.request import urlopen
>>> try:
... urlopen('http://www.pythonfoobarbaz.org')
... except Exception as exc:
... err = exc
... print('err:', err)
... print('repr(err):', repr(err))
... print('err.errno:',
Changes by R. David Murray rdmur...@bitdance.com:
--
nosy: +denkoren
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6471
___
___
Python-bugs-list
Ezio Melotti added the comment:
I seem to remember writing code that fished the wrapped error
out using one of those attributrs...
That would be err.reason:
from urllib.request import urlopen
try:
urlopen('http://www.pythonfoobarbaz.org')
except Exception as exc:
print('err:', err)
Changes by Chris Jerdonek chris.jerdo...@gmail.com:
--
nosy: +cjerdonek
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6471
___
___
R. David Murray added the comment:
Ah, of course. I should have reread the whole issue :)
The backward compatibility is the big concern here. Regardless of what we do
about that, we should at least fix this in 3.4.
--
___
Python tracker
R. David Murray added the comment:
This is an interesting idea and should at least improve matters. I'm
wondering, though...I seem to remember writing code that fished the wrapped
error out using one of those attributrs...but I'm not at a computer where I can
try to check on that. Hopefully
Catherine Devlin added the comment:
It's very hard to tell what ought to be done here, since Lib/urllib/request.py
throws URLErrors with a great variety of order and number of arguments, and
it's not clear how URLError (in Lib/urllib/error.py) intends to handle them.
However, in this case,
Ezio Melotti ezio.melo...@gmail.com added the comment:
Can this be fixed without breaking compatibility?
It also affects Python2.7 and maybe also Python 3.x (there the error is
different and might be intentional).
Copy/pastable snippet to reproduce the error on 2.x:
from urllib import urlopen
Changes by R. David Murray rdmur...@bitdance.com:
--
title: errno and strerror attributes incorrectly set on socket.error - errno
and strerror attributes incorrectly set on socket errors wrapped by urllib
___
Python tracker rep...@bugs.python.org