[issue14439] RunModule(): display the traceback on failure
Nick Coghlan
report at bugs.python.org
Fri Mar 30 03:23:35 CEST 2012
Nick Coghlan <ncoghlan at gmail.com> added the comment:
Huh? Demonstration please, as the -m switch absolutely does display tracebacks when the call fails:
$ python -m timeit -s "raise RuntimeError"
Traceback (most recent call last):
File "/usr/lib64/python2.7/timeit.py", line 298, in main
x = t.timeit(number)
File "/usr/lib64/python2.7/timeit.py", line 194, in timeit
timing = self.inner(it, self.timer)
File "<timeit-src>", line 3, in inner
raise RuntimeError
RuntimeError
The only tracebacks it suppresses are those for ImportError during the search process, which is deliberate:
$ python -m missing
/usr/bin/python: No module named missing
It even avoids suppressing the traceback when the module is found and an import error occurs later:
$ python -m timeit -s "import missing"
Traceback (most recent call last):
File "/usr/lib64/python2.7/timeit.py", line 298, in main
x = t.timeit(number)
File "/usr/lib64/python2.7/timeit.py", line 194, in timeit
timing = self.inner(it, self.timer)
File "<timeit-src>", line 3, in inner
import missing
ImportError: No module named missing
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14439>
_______________________________________
More information about the Python-bugs-list
mailing list