Message100178
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
try:
urlopen('http://www.pythonfoobarbaz.org')
except Exception, err:
print 'err:', err
print 'repr(err):', repr(err)
print 'err.errno:', err.errno
print 'err.strerror:', err.strerror
print 'err.strerror.errno:', err.strerror.errno
print 'err.strerror.strerror:', err.strerror.strerror
Result on 2.7:
err: [Errno socket error] [Errno -2] Name or service not known
repr(err): IOError('socket error', gaierror(-2, 'Name or service not known'))
err.errno: socket error
err.strerror: [Errno -2] Name or service not known
err.strerror.errno: -2
err.strerror.strerror: Name or service not known
Copy/pastable snippet to reproduce the error on 3.x:
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:', err.errno)
print('err.strerror:', err.strerror)
print('err.reason:', err.reason)
print('err.reason.errno:', err.reason.errno)
print('err.reason.strerror:', err.reason.strerror)
Result on 3.2:
err: <urlopen error [Errno -2] Name or service not known>
repr(err): URLError(gaierror(-2, 'Name or service not known'),)
err.errno: None
err.strerror: None
err.reason: [Errno -2] Name or service not known
err.reason.errno: -2
err.reason.strerror: Name or service not known |
|
Date |
User |
Action |
Args |
2010-02-27 09:25:02 | ezio.melotti | set | recipients:
+ ezio.melotti, georg.brandl, amaury.forgeotdarc, orsenthil, r.david.murray |
2010-02-27 09:25:02 | ezio.melotti | set | messageid: <1267262702.45.0.403524213706.issue6471@psf.upfronthosting.co.za> |
2010-02-27 09:25:00 | ezio.melotti | link | issue6471 messages |
2010-02-27 09:24:59 | ezio.melotti | create | |
|