This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xtreak
Recipients Ankit Goel, paul.j3, xtreak
Date 2018-09-20.10:41:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1537440064.68.0.956365154283.issue34742@psf.upfronthosting.co.za>
In-reply-to
Content
Seems like a reasonable addition (Customization of writing to sys.stderr too) . It seems to have been inherited from optparse which has pretty much the same code with hardcoded exit code. The solution suggested is to catch SystemExit and provide custom status code or subclass ArgumentParser.

Googling "custom exit code ArgumentParser.error" gave me some discussions : 

* https://stackoverflow.com/questions/5943249/python-argparse-and-controlling-overriding-the-exit-status-code
* https://groups.google.com/forum/#!topic/comp.lang.python/NwsDljv_edk
* PEP discussion on sys.exit and stderr: https://www.python.org/dev/peps/pep-0389/#discussion-sys-stderr-and-sys-exit
* Open issue to customize stderr that might be helpful if someone wants to add a patch for custom exit code : https://bugs.python.org/issue9938

Thanks
History
Date User Action Args
2018-09-20 10:41:04xtreaksetrecipients: + xtreak, paul.j3, Ankit Goel
2018-09-20 10:41:04xtreaksetmessageid: <1537440064.68.0.956365154283.issue34742@psf.upfronthosting.co.za>
2018-09-20 10:41:04xtreaklinkissue34742 messages
2018-09-20 10:41:04xtreakcreate