Message124219
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. |
|
| Date |
User |
Action |
Args |
| 2010-12-17 15:58:04 | bethard | set | recipients:
+ bethard, eric.araujo, docs@python, jayt, tanqazx |
| 2010-12-17 15:58:03 | bethard | set | messageid: <[email protected]> |
| 2010-12-17 15:58:02 | bethard | link | issue9938 messages |
| 2010-12-17 15:58:02 | bethard | create | |
|