Title: Handle no arguments when using sub-commands in argparse · Issue #99735 · python/cpython · GitHub
Open Graph Title: Handle no arguments when using sub-commands in argparse · Issue #99735 · python/cpython
X Title: Handle no arguments when using sub-commands in argparse · Issue #99735 · python/cpython
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 ...
Open Graph 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...
X 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: 'Names...
Opengraph URL: https://github.com/python/cpython/issues/99735
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Handle no arguments when using sub-commands in argparse","articleBody":"# Documentation\r\n\r\nThe 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:\r\n\r\n`AttributeError: 'Namespace' object has no attribute 'func'`\r\n\r\nA pull request is provided that adds one line to handle that case and an explanation in the documentation.\r\n\r\n\u003c!-- gh-linked-prs --\u003e\r\n### Linked PRs\r\n* gh-99736\r\n* gh-100927\n* gh-102036\n* gh-102037\n\u003c!-- /gh-linked-prs --\u003e\r\n","author":{"url":"https://github.com/ppaez","@type":"Person","name":"ppaez"},"datePublished":"2022-11-23T21:15:47.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/99735/cpython/issues/99735"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bdf32b5e-acaa-faab-40f3-0d4a80d6541c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A09C:2D2FEF:100369E:157D79A:696991D0 |
| html-safe-nonce | 9ad722426de699e331d19cf8d06b7feb34f25dd5d7dec1678f82a56c8c10f98c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMDlDOjJEMkZFRjoxMDAzNjlFOjE1N0Q3OUE6Njk2OTkxRDAiLCJ2aXNpdG9yX2lkIjoiOTEyMzQ1MzcyNjE3NTYyOTc3NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 48b00531ac315e1e6400f835c39145c4f82a7a4d6736f2ec4564aaa557e036a3 |
| hovercard-subject-tag | issue:1462416164 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/99735/issue_layout |
| twitter:image | https://opengraph.githubassets.com/1ae2f653b492f7d5393d7ada43632f8c694bae995a93549eeed4371d432ba5ae/python/cpython/issues/99735 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1ae2f653b492f7d5393d7ada43632f8c694bae995a93549eeed4371d432ba5ae/python/cpython/issues/99735 |
| og:image:alt | 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ppaez |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3542e147982176a7ebaa23dfb559c8af16f721c03ec560c68c56b64a0f35e751 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | af80af7cc9e3de9c336f18b208a600950a3c187c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width