Any of those help The setuptools console_scripts entry point wants a function of no arguments. Happily, optparse (Parser for command line options) doesn't need to be passed any arguments, it will read in sys.argv[1:] and use that as it's input.
wish helps you The reason you don't want to return from error is that the parser will continue parsing. Some errors are raised near the end (e.g. about unparsed strings), but others can occur early (e.g. bad type for the first argument string). The behavior of parse_args is unpredictable if you return from the error method. Normally you want the parser to quit and return control your code. What you want to do is wrap the parse_args() call in a try: except SystemExit: block. I often use test scripts like this:
for test in ['-o FILE',