Author geophile
Recipients geophile
Date 2020-01-14.20:36:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1579034214.28.0.98730978231.issue39333@roundup.psfhosted.org>
In-reply-to
Content
If parse_args fails, SystemExit is raised, carrying an exit code of 2, and the help message is printed. For an embedded usage of argparse, this behavior is undesirable.

I am writing an interactive console application, using argparse to parse input. When a parse fails, I would like to print an error message and continue, not terminate the program. Currently, I need to catch SystemExit to be able to do this, which has obvious problems, (e.g., what if something other that argparse is causing the exit?)

I'd like to see some way to specify alternative behavior, e.g. raise an exception of a given type.
History
Date User Action Args
2020-01-14 20:36:54geophilesetrecipients: + geophile
2020-01-14 20:36:54geophilesetmessageid: <1579034214.28.0.98730978231.issue39333@roundup.psfhosted.org>
2020-01-14 20:36:54geophilelinkissue39333 messages
2020-01-14 20:36:53geophilecreate