Steven Bethard <steven.beth...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue9938>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to