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.
Created on 2015年07月16日 16:30 by Antony.Lee, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Messages (5) | |||
|---|---|---|---|
| msg246808 - (view) | Author: Antony Lee (Antony.Lee) * | Date: 2015年07月16日 16:30 | |
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> pdb.main() 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> |
|||
| msg246811 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2015年07月16日 18:47 | |
Please open individual issues to address individual modules that you would like to contribute to improving. Adding/fixing help is often best done by rewriting the argument parsing...contributions have been made to improve several modules already. In most cases we don't have tests for the -m features, and those need to be created first. In some cases we don't really want to continue to support whatever -m code exists (because it exists for no-longer-relevant historical reasons...though that doesn't apply in the two cases you reference). So each module needs to be addressed individually. To address the specific issue you raise: I believe that when we have rewritten things, we have chosen to follow argparse's lead and support both -h and --help for the display of help information. |
|||
| msg246835 - (view) | Author: Antony Lee (Antony.Lee) * | Date: 2015年07月16日 22:47 | |
To be honest I don't really plan to contribute any patch on this specific issue right now, the CLI interface of e.g. trace has some other serious issues (see e.g. #24649) that I don't want to work out, and writing tests for the CLI are a pain too (also why I haven't made more progress on #23596). |
|||
| msg246852 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2015年07月17日 13:48 | |
Yes, that's pretty much why things are in the state they are in ;) Still, opening individual issues for help problems with individual modules is the way to go, as you did (thank you). |
|||
| msg246855 - (view) | Author: Ezio Melotti (ezio.melotti) * (Python committer) | Date: 2015年07月17日 14:11 | |
> writing tests for the CLI are a pain too
It shouldn't be particularly difficult to do it using script_helper.assert_python_{ok|failure}(), even though you could also check the argument /parsing/ separately without having to launch a subprocess.
|
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:18 | admin | set | github: 68832 |
| 2015年07月17日 14:11:39 | ezio.melotti | set | nosy:
+ ezio.melotti messages: + msg246855 |
| 2015年07月17日 13:48:55 | r.david.murray | set | messages: + msg246852 |
| 2015年07月16日 22:47:11 | Antony.Lee | set | messages: + msg246835 |
| 2015年07月16日 18:47:09 | r.david.murray | set | status: open -> closed nosy: + r.david.murray messages: + msg246811 resolution: later stage: resolved |
| 2015年07月16日 16:30:57 | Antony.Lee | create | |