New submission from Jack Orenstein <j...@geophile.com>:
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. ---------- components: Library (Lib) messages: 359991 nosy: geophile priority: normal severity: normal status: open title: argparse should offer an alternative to SystemExit in case a parse fails type: enhancement _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39333> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com