[issue42297] [argparse] Bad error message formatting when using custom usage text

2021-08-06 Thread Bob Blanchett
Change by Bob Blanchett : -- nosy: +bobblanchett ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue42297] [argparse] Bad error message formatting when using custom usage text

2020-11-10 Thread paul j3
paul j3 added the comment: We could look into using a different more compact 'prog' for these error messages. Currently the subparser 'prog' uses the main prog plus positionals plus the subparser name. The goal is to construct a subparser usage that reflects required input. This is fine

[issue42297] [argparse] Bad error message formatting when using custom usage text

2020-11-09 Thread Jake Hunsaker
Jake Hunsaker added the comment: Ok, yeah there seem to be several paths to avoid this behavior then. We should be fine exploring those options. Thanks for the pointer! -- ___ Python tracker _

[issue42297] [argparse] Bad error message formatting when using custom usage text

2020-11-09 Thread paul j3
paul j3 added the comment: It's the subparser that's producing this error, specifically its 'prog' attribute. If I use a custom usage with a simple parser: 1129:~/mypy$ python3 issue42297.py --foo=on usage: issue42297.py one two three issue42297.py: error: argument --

[issue42297] [argparse] Bad error message formatting when using custom usage text

2020-11-09 Thread Jake Hunsaker
Jake Hunsaker added the comment: Ah, ok - so I neglected to mention we're using subparsers which appears to be relevant here. My apologies. Here's a minimal reproducer that shows the behavior when using './arg_test.py foo --bar=on' ``` #! /bin/python3 import argparse usage_string = 'test

[issue42297] [argparse] Bad error message formatting when using custom usage text

2020-11-09 Thread Jake Hunsaker
Jake Hunsaker added the comment: I'll try and get a simple reproducer made shortly, however as a quick note I've found that using '--all-logs on' results in a properly formatted error message. -- ___ Python tracker

[issue42297] [argparse] Bad error message formatting when using custom usage text

2020-11-09 Thread paul j3
paul j3 added the comment: Provide a minimal reproducible example. I can't reproduce that run on error message. Also test with arguments like '--all-logs on', which issues an 'unrecognizeable argument' error (with a different error reporting path). Stripping excess newlines is normal, both

[issue42297] [argparse] Bad error message formatting when using custom usage text

2020-11-09 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +paul.j3, rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscr

[issue42297] [argparse] Bad error message formatting when using custom usage text

2020-11-09 Thread Jake Hunsaker
New submission from Jake Hunsaker : In the sos project, we build a custom `usage` string for our argparser parser, and have noticed that doing so causes error messages from argparse to be badly formatted. For example if a bad option value is given, the error message is mangled into the last