Message235602
Originaly reported here: https://bugzilla.redhat.com/show_bug.cgi?id=1160640
I've forgotten to add the sort value to the -s option of cProfile which results in a traceback instead of user friendly error message. In the example below hello.py just prints a "Hello World":
$ python -m cProfile -s hello.py
Traceback (most recent call last):
File "/usr/lib64/python2.6/runpy.py", line 122, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib64/python2.6/runpy.py", line 34, in _run_code
exec code in run_globals
File "/usr/lib64/python2.6/cProfile.py", line 190, in <module>
main()
File "/usr/lib64/python2.6/cProfile.py", line 185, in main
parser.print_usage()
File "/usr/lib64/python2.6/optparse.py", line 1597, in print_usage
print >>file, self.get_usage()
File "/usr/lib64/python2.6/optparse.py", line 1583, in get_usage
self.expand_prog_name(self.usage))
File "/usr/lib64/python2.6/optparse.py", line 1560, in expand_prog_name
return s.replace("%prog", self.get_prog_name())
File "/usr/lib64/python2.6/optparse.py", line 1555, in get_prog_name
return os.path.basename(sys.argv[0])
IndexError: list index out of range
Tested with python2.7, python3.4 with the same result.
Attached patch adds `choices` for sort option of cProfile.
> $ python -m cProfile -s sdds.py
Usage: cProfile.py [-o output_file_path] [-s sort] scriptfile [arg] ...
cProfile.py: error: option -s: invalid choice: 'sdds.py' (choose from 'cumulative', 'module', 'ncalls', 'pcalls', 'file', 'line', 'name', 'calls', 'stdname', 'nfl', 'filename', 'cumtime', 'time', 'tottime') |
|
Date |
User |
Action |
Args |
2015-02-09 12:05:42 | rkuska | set | recipients:
+ rkuska |
2015-02-09 12:05:42 | rkuska | set | messageid: <1423483542.47.0.873331461969.issue23420@psf.upfronthosting.co.za> |
2015-02-09 12:05:42 | rkuska | link | issue23420 messages |
2015-02-09 12:05:41 | rkuska | create | |
|