find() if not found throws exception - has problems
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SikuliX |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
documentation says:
setThrowExcepti
Sets the flag of throwing exceptions if find() fails.
Setting this flag to True enables all methods that use find() throws an exception if the find() can not find anything similar on the screen. Once the flag is set to False, all methods that use find() just return None if nothing is found.
The default value of thie flag is True.
1. default value is False. you have to say setThrowExcepti
2. Class defs give the impression, that an error FindFailed is defined, but except FindFailed: gives name error
3. saying except Exception: gives a java crash in the find()
4. finally: gives a syntax error
5. sys.exc_info() works, module traceback does not work as expected
this is what works:
import sys, re
setThrowExcepti
myErr = False
expr=re.
try:
click( )
except:
err = str(sys.
m = expr.match(err)
myErr = True
if m:
print "++++ FindFailed ++++ "+m.group(2)
popup(
Changed in sikuli: | |
status: | New → Fix Committed |
Want to know my final well running version for now?
look: How to do an easy not-found handling? (https:/ /answers. launchpad. net/sikuli/ +question/ 101431)