Why is my loop failing?

Asked by DEV_NULL

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'))"

however that loop code at the top works in other scripts.

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)

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
DEV_NULL
Solved:
Last query:
Last reply:
Revision history for this message
DEV_NULL (barry-kavanagh2000) said :
#1

Looks like my indentation and some syntax was incorrect, I needed to remove the indentation on
for n in range(200): and change my else if to elif