6.20.2.6 Error-handling
Description: Error-handling
Keywords: lib

###
6.20.2.6 Error-handling

The one thing you need to know for basic usage is how `optparse` behaves when it encounters an error on the command-line--e.g. -n 4x where -n is an integer-valued option. In this case, `optparse` prints your usage message to stderr, followed by a useful and human-readable error message. Then it terminates (calls `sys.exit()`) with a non-zero exit status.

If you don't like this, subclass `OptionParser` and override the `error()` method. See section 6.20.5, ``Extending `optparse`.''