← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #483025]: Image taken at runtime isn't updated in Sikuli --- HowTo force the update

 

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

Summary changed to:
Image taken at runtime isn't updated in Sikuli --- HowTo force the update

Description changed to:
--- How to force the update:

***  to permanently switch off image caching use:
Settings.setImageCache(0)
... from that time on every image will be loaded from its file whenever used 

*** to force the reload of an image after having changed its file content during runtime of the script while image caching is not switched of:
(only works with version 1.1.1 after 2017-02-25)
Image.reload(image)
... where image is the same string that is used to define the image - example
img = "someImage.png"
find(img) # old version used
# do something to change the content of the image file 
Image.reload(img) # or
Image.reload("someImage.png")
find(img) # new version used

------------------------------------------------------------------------------------------------
My sikuli application takes a snapshot of a user selection in a dropdown list.  
It then does various actions with this screenshot, and finishes its execution.
This works brilliantly.

When the user runs the script again, it overwrites the image file with the new dropdown selection.  (as it should)
But for some reason, the second time, it continues looking for the original screenshot.
If I close & reopen Sikuli, it then registers the updated screenshot and works fine.

It seems like the original image is cached, despite it being overwritten by Sikuli.
So I've tried using:  Image.reload(filename.png)
I've also tried using: Settings.setImageCache(0)

Despite that, it works the first execution, fails on the second.  But
works if Sikuli is restarted.

Any help would be very appreciated!

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.