Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:

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

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34742>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to