← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #177997]: IDE: Not used images are purged when saving script --- solution

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Sorry, for not having clearly said: I did not have any problems with
your code, it worked perfectly (after some minor adjustments (class Log
missing) and substituting the try:/except: construct with an exists()).

additional comments:

--- because i'm doing a large project
ok, understood. some background information, that I could not know.

Then even more: I recommend, to use the above mentioned structure:
-- mainX.sikuli: one or more scripts containing the workflow
-- subX.sikuli: one or more modules containing shared code and some static images
-- imageX.sikuli: one ore more folders containing only images and might be some supporting code for image management

--- IDE(it's only for preview and testing)
So how did you manage, to preview the images of the keys in the IDE in this case? Did you use the button "load image", to get the thumbnail into the IDE, to be able to start a Preview for it?

--- you can test my code without saving it in IDE
Of course I can ;-)
But for reproducing situations like the one you came with, it is easier for me to use the IDE.

As already mentioned: the try:/except: construct you use, obscures the FindFailed variant, that is caused by a missing image file. With the current version of Sikuli X, there is no longer any need, to use try:/except: for catching FindFailed exceptions.
In cases where you are not sure, wether something is there, use exists(). In all other cases with find(), click(), ... it is normally acceptable, that the script aborts, because the workflow is broken at this point anyway. And if it is possible to recover, then using exists() is much clearer and easier.

In fact, after getting aware of the "image problem" in your case, I
restructured your code and images as recommended above and had no
problem to get it working.

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