homepage

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.

Author ezio.melotti
Recipients amaury.forgeotdarc, catherine, ezio.melotti, georg.brandl, orsenthil, r.david.murray
Date 2012年09月19日.07:51:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1348041065.85.0.49438838444.issue6471@psf.upfronthosting.co.za>
In-reply-to
Content
> 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')
History
Date User Action Args
2012年09月19日 07:51:05ezio.melottisetrecipients: + ezio.melotti, georg.brandl, amaury.forgeotdarc, orsenthil, r.david.murray, catherine
2012年09月19日 07:51:05ezio.melottisetmessageid: <1348041065.85.0.49438838444.issue6471@psf.upfronthosting.co.za>
2012年09月19日 07:51:05ezio.melottilinkissue6471 messages
2012年09月19日 07:51:05ezio.melotticreate

AltStyle によって変換されたページ (->オリジナル) /