skips while not exists part and goes on with the find part before the previous png even shows up

Asked by Yufka

Sikili 1.1.1
64-bitcounter = 0
while counter <= 100:
    if exists("1513702115392.png"):
        click("1513702124801.png")
        click("1513702999017.png")
        wait("1513703252801.png")
        click("1513702904737.png")
        wait("1513782686991.png")
        click("1513703290993.png")
        click("1513703311327.png")
        wait("1513694812235.png")
        click("1513694816836.png")
        while not exists("1513694540986.png"):
            sleep(5)
            find("1513694540986.png")
            click("1513694683405.png")
            while not exists("1513694704656.png"):
                sleep(3)
                click("1513694727672.png")

                if exists("1513694781203.png"):
                    click("1513694798979.png")
                    wait("1513694812235.png")
                    click("1513694816836.png")

                else:
                        exists("1513697499276.png")
                        click("1513697512463.png")
                        wait("1513694812235.png")
                        click("1513694816836.png")

    else:
        find("1513694342504.png")
        click("1513694342504.png")
        while not exists("1513694540986.png"):
            sleep(5)
            find("1513694540986.png")
            click("1513694683405.png")
            while not exists("1513694704656.png"):
                sleep(3)
                click("1513694727672.png")
                if exists("1513694781203.png"):
                    click("1513694798979.png")
                    wait("1513694812235.png")
                    click("1513694816836.png")
                else:
                    exists("1513697499276.png")
                    click("1513697512463.png")
                    wait("1513694812235.png")
                    click("1513694816836.png")
    def found(event):
        find("1513966961859-1.png")
        click("1513966968233-1.png")
        find("1513966985571-1.png")
        click("1513966994119-1.png")
        find("1513967001712-1.png")
        click("1513967007921-1.png")
        if exists("1513702115392.png"):
            click("1513702124801.png")
            click("1513702999017.png")
            wait("1513703252801.png")
            click("1513702904737.png")
            wait("1513782686991.png")
            click("1513703290993.png")
            click("1513703311327.png")
            wait("1513694812235.png")
            click("1513694816836.png")
            while not exists("1513694540986.png"):
                sleep(5)
                find("1513694540986.png")
                click("1513694683405.png")
                while not exists("1513694704656.png"):
                    sleep(3)
                    click("1513694727672.png")
                    if exists("1513694781203.png"):
                        click("1513694798979.png")
                        wait("1513694812235.png")
                        click("1513694816836.png")
                    else:
                        exists("1513697499276.png")
                        click("1513697512463.png")
                        wait("1513694812235.png")
                        click("1513694816836.png")
        else:
            find("1513694342504.png")
            click("1513694342504.png")
            while not exists("1513694540986.png"):
                sleep(5)
                find("1513694540986.png")
                click("1513694683405.png")
                while not exists("1513694704656.png"):
                    sleep(3)
                    click("1513694727672.png")
                    if exists("1513694781203.png"):
                        click("1513694798979.png")
                        wait("1513694812235.png")
                        click("1513694816836.png")
                    else:
                        exists("1513697499276.png")
                        click("1513697512463.png")
                        wait("1513694812235.png")
                        click("1513694816836.png")
                        reg = Region(1321,324,379,133)
                        reg.onAppear("1513974179601.png", found)
                        reg.observe(FOREVER,background=True)
if exists("1513702115392.png"):
        click("1513702124801.png")
        click("1513702999017.png")
        wait("1513703252801.png")
        click("1513702904737.png")
        wait("1513782686991.png")
        click("1513703290993.png")
        click("1513703311327.png")
        wait("1513694812235.png")
        click("1513694816836.png")
        while not exists("1513694540986.png"):
            sleep(5)
            find("1513694540986.png")
            click("1513694683405.png")
            while not exists("1513694704656.png"):
                sleep(3)
                click("1513694727672.png")

                if exists("1513694781203.png"):
                    click("1513694798979.png")
                    wait("1513694812235.png")
                    click("1513694816836.png")

                else:
                        exists("1513697499276.png")
                        click("1513697512463.png")
                        wait("1513694812235.png")
                        click("1513694816836.png")

else:
    find("1513694342504.png")
    click("1513694342504.png")
    while not exists("1513694540986.png"):
        sleep(5)
        find("1513694540986.png")
        click("1513694683405.png")
        while not exists("1513694704656.png"):
            sleep(3)
            click("1513694727672.png")
            if exists("1513694781203.png"):
                click("1513694798979.png")
                wait("1513694812235.png")
                click("1513694816836.png")
            else:
                exists("1513697499276.png")
                click("1513697512463.png")
                wait("1513694812235.png")
                click("1513694816836.png")
counter+0

[error] script [ lutscher ] stopped with error in line 37
[error] FindFailed ( 1513694540986.png: (205x48) in S(0)[0,0 1920x1080] E:Y, T:3,0 )

Question information

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

not a bug

Revision history for this message
Best RaiMan (raimund-hocke) said :
#2

thats logic ;-)

this is the relevant part

35 while not exists("1513694540986.png"):
36 sleep(5)
37 find("1513694540986.png")

in 35 you look for 3 seconds for 1513694540986 image.
If it still does not exist, it continues with line 36 and 37 and crashes with FindFailed in 37

in 35 it does not exist and after 3 + 5 seconds it still does not exist.

... as mentioned: logical ;-)

Revision history for this message
Yufka (yufkafresser) said :
#3

Oh man thanks for the quick answer

should be able to fix this now :)

Revision history for this message
Yufka (yufkafresser) said :
#4

Thanks RaiMan, that solved my question.