Closed
Description
Documentation
The example that shows the use of sub-commands and set_defaults to dispatch a function for each sub-command, fails when there are no command line arguments:
AttributeError: 'Namespace' object has no attribute 'func'
A pull request is provided that adds one line to handle that case and an explanation in the documentation.
Linked PRs
- gh-99735: Handle no arguments when using sub-commands in argparse #99736
- gh-99735: Use required=True in argparse subparsers example #100927
- [3.11] gh-99735: Use required=True in argparse subparsers example (GH-100927) #102036
- [3.10] gh-99735: Use required=True in argparse subparsers example (GH-100927) #102037
Metadata
Metadata
Assignees
Projects
Status
Done