[error] Region.exists: seems that imagefile could not be found on disk

Asked by Daniel Gessler

Hello!

As shown in the topic, I got an error:
[error] Region.exists: seems that imagefile could not be found on disk
What I do is simple: I surround a block of code with try except FindFailed. Inside it I put a click(some_image) and just after this - if not exists(wait(some_new_image),5): write_sth_to_file_and_exit
Looks like that:
try:
 click(some_image)
 if not exists(wait(some_new_image),5):
  write_to_file_that_something_did_not_appear_on_the_screen_as_expected
except FindFailed:
 doSthIfFailed
Unfortunately at this moment and at next exists functions (I tried to comment the first one to see if the error will flee) I get the same error as writen above. I multi-checked my disk and I really do have the image on it. I checked its title and it's the same so there is no such thing as non-existing file on a disk.

Do you have any idea what's goin on?

Greetings,
Daniel

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
Roman Podolyan (podolyan-roman) said :
#1

What is the version you are using?
What is in raw .py code of the script?
Did you try to check if exists() works in some other simple test?

Revision history for this message
Daniel Gessler (danioss) said :
#2

Hello!
I just created a simple click on windows icon and checking whether the 'My documents' and other stuff are there. It says the same - [error] Region.exists: seems that imagefile could not be found on disk .

I got the newest version of Sikuli, 1.0.1.

Raw .py code of the example I just created (as said above) is this:

click("1377850187684.png")
if not exists(wait("1377850214554.png",5)):
    print "blablabla"

I checked, these two .png files are where they should be.

Oh, and one more things. Before adding this comment I decided to leave the wait function and you know what? It worked well. So the problem is wait function. Unfortunately in my project I can't get rid of it, actually I use it almost all the time... It's funny but everything worked well untill yesterday though I didn't do anything special.

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

--- if not exists(wait("1377850214554.png",5)):

This is not a "legal" usage:

--- exists(xxx)
... expects xxx to be some image file name

--- wait(xxx)
... returns a Match object at success, which will internally be changed to a string (what you get when you say print wait(xxx)), which definitely is not a valid image filename.

what you want to achieve, can simply be done this way:
if not exists("1377850214554.png",5):

Revision history for this message
Daniel Gessler (danioss) said :
#4

Thank you very much for solving the problem. My bad I already forgot return values. But on the other hand I've been using exists(wait(image,5)) since last 4 weeks (and I didn't have Sikuli 1.0.1) and it all worked fine. That calmed me down I guess and I thought there might be something else. Thank you !

Revision history for this message
Daniel Gessler (danioss) said :
#5

Thanks RaiMan, that solved my question.