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 serhiy.storchaka
Recipients akira, ezio.melotti, pitrou, r.david.murray, serhiy.storchaka, vstinner
Date 2014-10-01.06:29:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <2579274.IyylMN08gj@raxxla>
In-reply-to <1412105212.0.0.440206083525.issue22472@psf.upfronthosting.co.za>
Content
вівторок, 30-вер-2014 19:26:52 ви написали:
> How do I reconstruct an arbitrary OSError error message using the filename
> parameter?

if not e.args:
    msg = ''
elif len(e.args) == 1:
    msg = str(e.args[0])
elif len(e.args) <= 5:
    msg = '[Error %s] %s' % e.args[:2]
    if len(e.args) > 2:
        msg = '%s: %r' % (msg, e.args[2]) # filename
    if len(e.args) > 4:
        msg = '%s -> %r' % (msg, e.args[4]) # filename2
else:
    msg = str(e.args)
History
Date User Action Args
2014-10-01 06:29:27serhiy.storchakasetrecipients: + serhiy.storchaka, pitrou, vstinner, ezio.melotti, r.david.murray, akira
2014-10-01 06:29:26serhiy.storchakalinkissue22472 messages
2014-10-01 06:29:26serhiy.storchakacreate