← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #166273]: How to set global variables from methods or function?

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
The def's do not make sense:

instead of:

def value_not_found():
 global value_not_found
 value_not_found=1

def valuefound():
 global value_not_found
 value_not_found=0

do it this way:

def value_not_found():
 return False

def value_found():
 return True

usage:

if value_found():
   # do something

nevertheless, your problem in your version is:

value_not_found=0
def value_not_found():
 global value_not_found

you use the same name for different things and
with the last definition (global ... ) counts and makes it an integer that is not callable, as the message tells you.

Pls. learn some Python and consult the docs, before asking trivial
things.

Last time - now public: I miss your feedback !
If you do not give back, I will stop answering, sorry.

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