The whole point of creating and populating an OptionParser is to call its parse_args() method:
(options, args) = parser.parse_args(args=None, options=None)
where the input parameters are
argssys.argv[1:] by default)
optionsand the return values are
optionsoptions, or the new
optparse.Values instance created by optparse
args
The most common usage is to supply neither keyword argument. If you
supply a values object, it will be repeatedly modified with a
setattr() call for every option argument written to an option
destination, and finally returned by parse_args().
If parse_args() encounters any errors in the argument list, it calls the OptionParser's error() method with an appropriate end-user error message. This ultimately terminates your process with an exit status of 2 (the traditional Unix exit status for command-line errors).
See About this document... for information on suggesting changes.