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 loewis
Recipients
Date 2006-09-16.17:52:11
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=21627

Exceptions do have structured informations, for example

py> try:
...   open("/tmp/xxx")
... except IOError, e:
...   print e.__dict__
...
{'errno': 2, 'args': (2, 'No such file or directory'),
'strerror': 'No such file or directory', 'filename': '/tmp/xxx'}

It's just that ImportError doesn't, so I'm retitling this
request to restrict attention to ImportError.

If you have other proposals for specific information that
should be on specific exceptions, please submit a separate
issue.

Would you like to work on this specific problem? I think
ImportError should get a module attribute (always set), and
a filename attribute (set only if a file was selected, yet
failed to import; otherwise set to None). It probably will
require some refactoring of C code to simplify raising
ImportError in the importing code.

Explicit raises of ImportError should also be considered;
those in the standard library should be fixed to include
atleast the module; raising ImportError without giving a
module should set the module to None.
History
Date User Action Args
2007-08-23 16:12:08adminlinkissue1559549 messages
2007-08-23 16:12:08admincreate