Closed as not planned
Description
Bug report
argparse doesn't convert hyphens to underscores in positional arguments
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('hyp-hens1')
parser.add_argument('--hyp-hens2')
args = parser.parse_args()
print(args.hyp_hens2)
print(args.hyp_hens1)
Should run fine when first arg is provided, instead
Traceback (most recent call last):
File "/app/output.s", line 11, in <module>
print(args.hyp_hens1)
^^^^^^^^^^^^^^
AttributeError: 'Namespace' object has no attribute 'hyp_hens1'. Did you mean: 'hyp-hens1'?
Your environment
- CPython versions tested on: 3.10.8
- Operating system and architecture: Linux x86
Metadata
Metadata
Assignees
Projects
Status
Doc issues