-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
argparse: ambiguous option reported with primary parser #109990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It's also present in the main branch. |
This is caused by combination of two bugs: #58573 and #104860. #124631 fixes the first issue in different way than #124000. It delays the check for ambiguous options until the option been consumed. The advantage is that it allows to use abbreviated long options (e.g. |
Bug report
Bug description:
When we have sub_parser argument which is substring of main parser, getting error as ambiguous option
python sample.py show -foo "data"
usage: PROG [-h] [-foobar FOOBAR] [-foobar1 FOOBAR1] {show} ...
PROG: error: ambiguous option: -foo could match -foobar, -foobar1
Observing with python 3.11.3. Earlier it works fine with python 3.5
CPython versions tested on:
3.11
Operating systems tested on:
Linux
Linked PRs
The text was updated successfully, but these errors were encountered: