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)
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')
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue6471>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com