Question #252079 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/252079

RaiMan proposed the following answer:
meanwhile you seem to have changed the content of the mentioned
question.

but anyway:
if you do not get a match (exists returns None) you say
return failed

What is failed?

if you now run the click with this whatever return value your have:
click(failed-whatever-this-is)

if failed can be casted to a string value, then it surely is not a valid
filename and hence you get the mentioned error, since Sikuli tries to
use the String for text search, but text search is switched off.

Raimund aka RaiMan
 
On 23 Jul 2014, at 22:07, katherine <question252...@answers.launchpad.net> 
wrote:

New question #252079 on Sikuli:
https://answers.launchpad.net/sikuli/+question/252079

in other words, i want for it to be okay if the image is not found on
the screen every time

in my code i have a class for images.

for every new image i instantiate an object of that class.

that object is used in click() and things like that.

if the image is on screen or appears before the time out, it works
great!

but when the image does not appear,  i get the textsearch switched off
error...but im not using text search....

class image()
def __init__(image_url, timer=10)
self.image = image_url
self.timer = timer
self.pattern = self.image_pattern()

def image_pattern(self):
return Pattern(self.image)

def get(self):
image_match = SCREEN.exists(self.pattern, self.timer)
if not image_match: return failed
else: return image_match


to instantiate:

my_image = image('/home/kyoung/images/image.png',  10)

then for a click

click(my_image.get())

i typed this from memory and i know some syntax was wrong but trust me
its not a syntax error how do i handle it if the image is not on screen?

-- 
You received this question notification because you are an answer
contact for Sikuli.

You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to