def main(): # Strip path command = os.path.basename(sys.argv[0]) if command[-3:] == '.py': # Strip '.py' extension command = command[0:len(command)-3] execute(command, commands)
def main(): try: command = sys.argv[1] except IndexError: raise Exception("Missing 'command' argument to %s" % sys.argv[0]) execute(command, commands)