Ninja2k
Ninja2k

Reputation: 879

Sikuli - Why is my loop failing?

Apologies if this is basic Python but I am not sure why my loop is failing in Sikuli, I get the error

"[error] Error message: SyntaxError: ("mismatched input '' expecting EOF", ('C:\Users\Barry\AppData\Local\Temp\sikuli-tmp2380907044371856896.py', 3, 4, ' for n in range(200):\n'))"

My Code is as Follows:

Settings.MoveMouseDelay = 1

    for n in range(200):
        if exists("1406144397515-1.png"):
            click("1406144397515-1.png")
            hover("1406214711706-1.png")
            mouseDown(Button.LEFT)
            wait(3)
            hover("rhSelect-1.png")
            click("1406147277952-1.png")
            mouseDown(Button.LEFT)
            mouseUp(Button.LEFT)
            wait(1)
            click("Upgrmg_i-1.png")
            wait(1)
            click("1406148755055-1.png")
            wait(2)
            hover("1406190237343-1.png")
            dragDrop("1406190237343-1.png", "j-1.png")
            click("1406190552325-1.png")
            wait(16)
            click("CcllaccRewar-1.png")

        else if exists("Llpgr_ing0wm.png"):
            click("Llpgr_ing0wm.png")
            click("1406148755055-1.png")
        else:
            sleep(5)

wait(2)

Upvotes: 0

Views: 403

Answers (1)

Nonnib
Nonnib

Reputation: 468

Your for loop is indented and it shouldn't be. Try it like this:

Settings.MoveMouseDelay = 1

for n in range(200):
    if exists("1406144397515-1.png"):
        ...
    elif exists("Llpgr_ing0wm.png"):
        ...
    else:
        ...

wait(2)

Upvotes: 1

Related Questions