-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Closed as not planned
Closed as not planned
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug description:
When using argparse library and adding arguments, having an argument name such as --my_arg can result in python interpreting any matching --my argument passed to command line to be viewed as --my_arg.
For Example, if I call my file below with the following argument, it will not error even though --model is not a valid argument created in parser, but --model_path is.
<python_version> test_arg_error.py --model /some/arbitrary/path
python file name: test_arg_error.py
import argparse
parser = argparse.ArgumentParser(description=" Argparse Error Description")
parser.add_argument("--model_path")
args = parser.parse_args()
CPython versions tested on:
3.10, 3.9
Operating systems tested on:
Linux
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
Doc issues