[issue15110] strange Tracebacks with importlib

Georg Brandl report at bugs.python.org
Wed Jun 20 08:41:45 CEST 2012


Georg Brandl <georg at python.org> added the comment:

I agree that this is not helpful at all in the usual case, i.e. when you *don't* want to debug importlib.  The one frame in actual user code (distutils in this case) in the middle is kind of hard to spot, but it is what you want to know.  Note that Amaury's example is quite small; in other projects the import chains may go on for 10-20 modules until the ImportError is raised.  Good luck finding out where the bad module was imported without cursing.

This is different from the normal case in user code calling stdlib code, which raises an exception: the user code frames will be near the top, and the stdlib code near the bottom.

I see several options here, in no particular order of preference:

1. special-case importlib._bootstrap when printing tracebacks
2. rewrite the traceback object when raising ImportErrors from importlib
5. (is there more?)

----------
assignee:  -> brett.cannon
nosy: +georg.brandl
priority: normal -> critical

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15110>
_______________________________________


More information about the Python-bugs-list mailing list