← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #158940]: To fix an error

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
this does not do what you expect:

   addImagePath("CC:\\Users\\268263\\Desktop\\download files_life insurance\\images\\")
   imgPath=list(getImagePath())
   for v1 in imgPath:
       if find(v1): **v1 is image searched in u1 PDF **
         m=find(v1).right().text()

--- addImagePath() 
adds the given path to the internal list of paths, where GIVEN images are looked for to be used in find operations.
This should never be in a loop, since is added every time. 

---   imgPath=list(getImagePath())
does not return the contained image files, but the list of paths, that might contain imgae files

--- error
so consequently v1 contains a path and not an image file name, which leads to the FindFailed exception (the next version will distinguish between "image file cannot be found" (your case) and "the image contained in the image file cannot be found on the screen") 

--- solution:
so you have to use functions from the modules os and shutil to generate a list of file names contained in the respective directory, that can be used to check against the PDF

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