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

I am trying to implement  a try block that will run a workflow, but if some 
error pops up at any point during that workflow take a screenshot of the entire 
screen and exit the script gracefully...

I've tried the try/catch in multiple ways. Its only working for me if the error 
popup happens at the beginning of the workflow. If the error popup occurs at 
some midpoint in the workflow, Sikuli eventually fails with the FindFailed img 
error...

Here are two examples of code I've tried:

 try:
            wait(3)
            click("1374255931092.png")                    
            type("1374246828238.png", ip)            
            type(username)         
            type(pwd)
            click(ok)
            wait("1374589171654.png",60)            
            click("1374602147221.png")
                               
            click("1374602316521.png")
        
            while not exists("1374602366701.png"):                              
          
                click("1374247849159.png")

        except "ErrorScreenshot.png":
            takeScreenShot()
             
        print ip, username, pwd
        return 0


-------------------------------------------------------------------------------
 try:
            wait(3)
            click("1374255931092.png")                    
            type("1374246828238.png", ip)            
            type(username)         
            type(pwd)
            click(ok)
            wait("1374589171654.png",60)            
            click("1374602147221.png")
                               
            click("1374602316521.png")
        
            while not exists("1374602366701.png"):                              
          
                click("1374247849159.png")

        except FindFailed:
            takeScreenShot()
             
        print ip, username, pwd
        return 0


*** in the except FindFailed case I get a global name not defined error...

Any help is appreciated.

Thanks
Jennifer

-- 
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     : [email protected]
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to