def print_help(): print('-h --help : print help screen') print('-c --config : path to config file') sys.exit(0) if __name__ == "__main__": try: conf = config.Config() #opt.parse_config_file('/etc/issak/issak.conf') conf.parse_config_file('issak.conf') except IOError as err: info.error(err,True) try: opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ["help"]) except getopt.GetoptError as error: print(str(error)) usage() sys.exit(1) #change assert to somting better :) for o,a in opts: if o in ("-h", "--help"): print_help() else: assert False, "unhandled option"