How to import stored Images

Asked by kishore

I written Gloabal function and calling this functions into main script by using command line(added import global also) but my question when i am execute through command line what ever images we have in global function those images are not in main script so its throwing error message images are not in main script

but my question how i need to keep all images in folder those images i need to call when ever execute main script

i tried to find the function called "getImagePath()","addimagepath()","removeimagepath()"

but my question was how i need to use this functions into script if any one have source code please share those code because am new to sikuli

Thanks for your great help

Regards,
Kishore

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

Againn when reading the docs, you should have read:

-> http://sikuli.org/docx/globals.html#importing-other-sikuli-scripts-reuse-code-and-images

quote:
... automatically access images contained in the imported .sikuli

quote:
... Note on contained images: Together with the import, Sikuli internally uses the new SIKULI_IMAGE_PATH to make sure that images contained in imported .sikuli’s are found automatically.

So if you import another xyz.sikuli, the images contained in xyz.sikuli are accessible in the calling script.

If not in your case, you are doing something wrong.

Revision history for this message
kishore (kishore-thotapally) said :
#2

Hi

In my frame work document i created folder Image, in that i keep all images.

in the main script i used the code like this

myscriptpath1='D:\\GAAutomationSikuli\\Global\\images'
sys.path.append(myscriptpath1)
import Images
reload(Images)

but its not adding those images in my script, please let me know

Regards,
Kishore

Revision history for this message
RaiMan (raimund-hocke) said :
#3

The folder that contains the images has to be named Images.sikuli in this case and must contain an (might be empty) Images.py for the import to work.

So if images contains the images currently, this is the needed usage:

Images folder:
D:\GAAutomationSikuli\Global\images.sikuli

Usage in script:

myscriptpath1='D:\\GAAutomationSikuli\\Global'
sys.path.append(myscriptpath1)
import Images
reload(Images)

Can you help with this problem?

Provide an answer of your own, or ask kishore for more information if necessary.

To post a message you must log in.