← Back to team overview

sikuli-driver team mailing list archive

[Question #248294]: exists doesen't seem to work inside def!!

 

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

When I am trying to do this, I get an error message for some reason and I can't seem to figure it out why:

def foo():
	if exists(someimage.jpg, 1):
		stuff='Hello'
	elif exists(someotherimage.jpg, 1):
		stuff='World'
foo()

print stuff

[error] NameError ( name 'stuff' is not defined )

BUT it works like this:

if exists(someimage.jpg, 1):
	stuff='Hello'
elif exists(someotherimage.jpg, 1):
	stuff='World'
print stuff	


I have also tried this, but no luck, still not working:

def foo()
	img1 = exists(someimage.jpg, 1)
	img2 = exists(someotherimage.jpg, 1)

	if img1 != None:
		stuff='Hello'
	elig img2 != None:
		stuff='World'
foo()

print stuff

I really don't know whats wrong..
Any help or advice is much appreciated!!

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