This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author trilader
Recipients trilader
Date 2022-01-19.21:04:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1642626270.03.0.621125172575.issue46440@roundup.psfhosted.org>
In-reply-to
Content
When calling ArgumentParser.parse_args(list_of_things_to_parse) sys.exit gets called even though the parser was constructed with exit_on_error=False. It doesn't matter if the parser has any subparsers added or not.

The docs say
> Normally, when you pass an invalid argument list to the parse_args() 
> method of an ArgumentParser, it will exit with error info.

> If the user would like to catch errors manually, the feature can be 
> enabled by setting exit_on_error to False:
> [example code follows]

The docs make me believe what I'm trying to do should work.
I've attached a minimal working example to show what happens (with and without subparsers).
History
Date User Action Args
2022-01-19 21:04:30triladersetrecipients: + trilader
2022-01-19 21:04:30triladersetmessageid: <1642626270.03.0.621125172575.issue46440@roundup.psfhosted.org>
2022-01-19 21:04:30triladerlinkissue46440 messages
2022-01-19 21:04:29triladercreate