exception handling

Asked by Garima Kumar

Hello Team,

i want to use Exception handling in my code.
throught some already asked questions on Launchpad i come to know that "sys.exc_info" will be having all the information about the exception raised.

i have wrote:
try:
    click("image.png")//assumes the image is not available
except findFailed:
    print "Failed"
    //wants to use sys.exc_info here to fetch the info it contains

for me print "Failed" itself is not getting executed in the above mentioned scanerio.
please provide me a peace of code for the same.

Thanks and Regards
Garima

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Garima Kumar
Solved:
Last query:
Last reply:
Revision history for this message
Eugene S (shragovich) said :
#1

Hi,

First of all pay attention at your "FindFailed" as it should be with 2 capital "F"s.
Then there is a bug #1216338 (name 'FindFailed' is not defined). As a workaround you should add the following line to your code before you use that exception:

import org.sikuli.script.FindFailed as FindFailed

Cheers,
Eugene

Revision history for this message
Garima Kumar (garima-bit-mca) said :
#2

Thanks Eugene

small F is typo error :)
and after adding the import line to my code, It's working for me
Thanks for your help.