[New-bugs-announce] [issue24644] --help for runnable stdlib modules

Antony Lee report at bugs.python.org
Thu Jul 16 18:30:57 CEST 2015

New submission from Antony Lee:

Support for python -m<runnable-stdlib-module> [-h|--help] is a bit patchy right now:

$ python -mpdb -h
usage: pdb.py [-c command] ... pyfile [arg] ...
<help elided>

$ python -mpdb --help
Traceback (most recent call last):
  File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.4/pdb.py", line 1685, in <module>
  File "/usr/lib/python3.4/pdb.py", line 1629, in main
    opts, args = getopt.getopt(sys.argv[1:], 'hc:', ['--help', '--command='])
  File "/usr/lib/python3.4/getopt.py", line 93, in getopt
    opts, args = do_longs(opts, args[0][2:], longopts, args[1:])
  File "/usr/lib/python3.4/getopt.py", line 157, in do_longs
    has_arg, opt = long_has_args(opt, longopts)
  File "/usr/lib/python3.4/getopt.py", line 174, in long_has_args
    raise GetoptError(_('option --%s not recognized') % opt, opt)
getopt.GetoptError: option --help not recognized
# <-- not a getopt specialist but --help is actually listed in the call to getopt!

$ python -mtrace -h
/usr/lib/python3.4/trace.py: option -h not recognized
Try `/usr/lib/python3.4/trace.py --help' for more information

$ python -mtrace --help
Usage: /usr/lib/python3.4/trace.py [OPTIONS] <file> [ARGS]
<help elided>

components: Library (Lib)
messages: 246808
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: --help for runnable stdlib modules
versions: Python 3.5

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list