New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sys.exit() called from optparse - bad, bad, bad #47329
Comments
This seems like a bug in optparse.OptionParser: def exit(self, status=0, msg=None):
if msg:
sys.stderr.write(msg)
sys.exit(status)
def error(self, msg):
"""error(msg : string)
By default I think it should raise an exception when it encounters an If you feel this behavior can't be changed in 2.6 it should at least The cruel irony is that inside OptionParser.parse_args it actually Skip |
The current behaviour is useful in that most of time, it is convenient |
I agree with Antoine that the standard behavior is what you want in most It's easy enough to replace the parser's exit function to just print the |
Georg> I agree with Antoine that the standard behavior is what you want in most
Check the code. Most of the time error is called without an exception Skip |
The current behavior of optparse is contrary to how most of Python |
There was recently a long discussion of this on python-dev (in the |
Thanks for the response! I can indeed catch SystemExit, but I would like to be able to take one Yours, Phillip R. David Murray wrote:
|
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: