I understand the error but I'm trying to add an if
statement to it.
def repeat():
message = input("command: ").split(" ")
if len(message) == 2: #if there is a first parameter
cmd,param = message #add it to the message
elif len(message) == 3: #if there is a first and second parameter
cmd,param,param2 = message #add it to the message
else: #if there is no first and second parameter
cmd = message #add just the command to the message
if cmd == "local":
if len(message) == 2 or len(message) == 3: #if there is a first or second parameter
print("error: no first or second parameter in command 'local'") #error
repeat()
else: #if there are no parameters
print("test") #execute the command
repeat()
else:
print("unrecognized command")
repeat()
repeat()
Edit: When I add a second parameter to the command 'local' it returns the error on line 11, but when I do not add a first or second parameter it prints "unrecognized command" used on line 17.