def main(argv=None): if argv is None: argv = sys.argv[1:] args = parser.parse_args(argv) assert not (args.debug and args.quiet), \ 'make up your mind: debug OR normal OR quiet' if args.debug: set_debug() if args.quiet: set_warning() if args.log: appendlog(args.log) if args.excepthook: sys.excepthook = traceit args.func(args)