Is this just Syntax issue or something else? Shell EZ5

I’m stuck on Stage #EZ5.

I’ve tried restructuring and adding print(f"{userInput} " :command not found")
as well as a space in sys.stdout.write("$ ")

Here are my logs:

[tester::#EZ5] ^ Expected prompt ("$ ") but received "Traceback (most recent call last):" 

And here’s a snippet of my code:

def main():
    runningLoop = True

    while runningLoop:
        sys.stdout.write("$ ")

        userInput = input()

        found = False

        for command in commands:
            if userInput.startswith(command):
                commands[command](userInput)
                found = True
                break

        if not found:
            print(f"{userInput} ": command not found")