← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #141103]: How to get string of PS into FindFailed exception clause

 

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

    Status: Answered => Open

Vivek Ayer is still having a problem:
Actually, since I just want the debug output of FindFailed, which
includes the path name of the image it couldn't find, I can just do
this:

try:
   click(PS)
except FindFailed, debugging:
   print debugging

The debugging output is stored in 'debugging', which I can then play
with.

Thanks for the tip!
Vivek

On Tue, Jan 11, 2011 at 11:54 PM, RaiMan
<question141103@xxxxxxxxxxxxxxxxxxxxx> wrote:
> Your question #141103 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/141103
>
>    Status: Open => Answered
>
> RaiMan proposed the following answer:
> Not a feature in the moment, you should post a [feature request] bug:
> match should know it's pattern.
>
> Since I "hated" FindFailed from beginning, I requested exists() ... and
> got it ;-)
>
> Solution with exists (works with try: except: as well ;-)
>
> img = Pattern or string
> if exists(img): click(getLastMatch())
> else: print "FindFailed:", img; exit(1)
>
> with exists() you might even go on in your script and take corrective
> actions in case of FindFailed.
>
> Tip:
> for such simple constructs like
>
> try:
>   click(PS)
> except FindFailed:
>   ?? how to get str(PS) here??
>
> I use to make it more readable:
>
> try: click(PS)
> except: print "error"; exit(1)
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/sikuli/+question/141103/+confirm?answer_id=0
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/sikuli/+question/141103
>
> You received this question notification because you are a direct
> subscriber of the question.
>

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