homepage

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 rkuska
Recipients rkuska
Date 2015年02月09日.12:05:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1423483542.47.0.873331461969.issue23420@psf.upfronthosting.co.za>
In-reply-to
Content
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')
History
Date User Action Args
2015年02月09日 12:05:42rkuskasetrecipients: + rkuska
2015年02月09日 12:05:42rkuskasetmessageid: <1423483542.47.0.873331461969.issue23420@psf.upfronthosting.co.za>
2015年02月09日 12:05:42rkuskalinkissue23420 messages
2015年02月09日 12:05:41rkuskacreate

AltStyle によって変換されたページ (->オリジナル) /