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 mattheww
Recipients mattheww
Date 2012-10-13.12:51:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
If I run my code using 'python -m' and there is an unhandled exception, the tracebacks include lines from (and now sometimes from importlib._bootstrap) which don't provide useful information, and tend to overwhelm the valuable part of the traceback.

I suppose this is in some sense a regression from Python 2.4.

echo fail >
python3.3 -m fail

python -m fail
Traceback (most recent call last):
  File "/usr/lib/python3.3/", line 160, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python3.3/", line 73, in _run_code
    exec(code, run_globals)
  File "./", line 2, in <module>
NameError: name 'fail' is not defined

Here I think it would be better to omit the first two traceback entries.

Syntax errors are worse:
echo syntax error >
python3.3 -m fail

Traceback (most recent call last):
  File "/usr/lib/python3.3/", line 140, in _run_module_as_main
    mod_name, loader, code, fname = _get_module_details(mod_name)
  File "/usr/lib/python3.3/", line 114, in _get_module_details
    code = loader.get_code(mod_name)
  File "<frozen importlib._bootstrap>", line 981, in get_code
  File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
  File "./", line 1
    syntax error

Here there are four traceback entries which could be omitted.
Date User Action Args
2012-10-13 12:51:41matthewwsetrecipients: + mattheww
2012-10-13 12:51:41matthewwsetmessageid: <>
2012-10-13 12:51:40matthewwlinkissue16217 messages
2012-10-13 12:51:39matthewwcreate