Message170710
> 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)
print('repr(err):', repr(err))
print('err.reason:', err.reason)
print('repr(err.reason):', repr(err.reason))
prints:
err: <urlopen error [Errno -2] Name or service not known>
repr(err): URLError(gaierror(-2, 'Name or service not known'),)
err.reason: [Errno -2] Name or service not known
repr(err.reason): gaierror(-2, 'Name or service not known') |
|
Date |
User |
Action |
Args |
2012-09-19 07:51:05 | ezio.melotti | set | recipients:
+ ezio.melotti, georg.brandl, amaury.forgeotdarc, orsenthil, r.david.murray, catherine |
2012-09-19 07:51:05 | ezio.melotti | set | messageid: <1348041065.85.0.49438838444.issue6471@psf.upfronthosting.co.za> |
2012-09-19 07:51:05 | ezio.melotti | link | issue6471 messages |
2012-09-19 07:51:05 | ezio.melotti | create | |
|