[docs] [issue9938] Documentation for argparse interactive use

Steven Bethard report at bugs.python.org
Fri Dec 17 16:58:04 CET 2010

Steven Bethard <steven.bethard at gmail.com> added the comment:

In the short term, just catch the SystemExit.

In the slightly longer term, we could certainly provide a subclass, say, ErrorRaisingArgumentParser, that overrides .exit and .error to do nothing but raise an exception with the message they would have printed. We'd probably have to introduce a new Exception subclass though, maybe ArgumentParserExit or something like that.

Anyway if you're interested in this, please file a new ticket (preferably  with a patch). Regardless of whether we ever provide the subclass, we certainly need to patch the documentation to tell people how to override error and exit.


Python tracker <report at bugs.python.org>

More information about the docs mailing list