[issue37803] "python -m pdb --help" does not work

daniel hahler report at bugs.python.org
Fri Aug 9 10:52:52 EDT 2019


New submission from daniel hahler <python-bugs at thequod.de>:

The long options passed to `getopt.getopt` should not include the leading dashes:


    % python -m pdb --help
    Traceback (most recent call last):
      File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "/home/daniel/src/pdbpp/pdb.py", line 1672, in <module>
        pdb.main()
      File "/usr/lib/python3.7/pdb.py", line 1662, in main
        opts, args = getopt.getopt(sys.argv[1:], 'mhc:', ['--help', '--command='])
      File "/usr/lib/python3.7/getopt.py", line 93, in getopt
        opts, args = do_longs(opts, args[0][2:], longopts, args[1:])
      File "/usr/lib/python3.7/getopt.py", line 157, in do_longs
        has_arg, opt = long_has_args(opt, longopts)
      File "/usr/lib/python3.7/getopt.py", line 174, in long_has_args
        raise GetoptError(_('option --%s not recognized') % opt, opt)
    getopt.GetoptError: option --help not recognized

(it works in Python 2.7)

----------
components: Library (Lib)
messages: 349291
nosy: blueyed
priority: normal
severity: normal
status: open
title: "python -m pdb --help" does not work
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37803>
_______________________________________


More information about the Python-bugs-list mailing list