sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #01948
[Question #151110]: importing .sikuli scripts won't import images --- use sys.path correctly
Question #151110 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/151110
Summary changed to:
importing .sikuli scripts won't import images --- use sys.path correctly
Description changed to:
solution:
the directory containing the imported .sikuli has to be in sys.path, not the .sikuli folders itself!
see: http://sikuli.org/docx/globals.html#importing-other-sikuli-scripts-reuse-code-and-images
----------------------------------------------------------
I'm working with the Mac IDE X-1.0rc2
When importing a bunch of .sikuli scripts in a "main" script none of the
images in the imported .sikuli scripts can be found.
The documentation says this:
"This is possible with Sikuli X:
* import other .sikuli in a way that is fully compatible with Python import
* import a python modul structure including underlying Java classes from a jar-file, that is dynamically loaded using the function load(jar-file)
* automatically access images contained in the imported .sikuli (no need to use setBundlePath())"
However, the last item there isn't happening. Whenever I run my main
script, as soon as it tries to find the first imported image file it
fails. If I open up the package for the "main" sikuli script and copy
over the images from the imported scripts' packages, it works fine.
However this is redundant because now I'm keeping every image file in
two places: inside of the imported script bundle and inside of the
"main" script bundle. Another annoying aspect of this is every time I
edit the "main" script, Sikuli IDE helpfully deletes all of the "unused"
images out of the package, so with every edit I have to re-copy the
files over from the imported scripts. Blah.
Why is this failing? Has anyone else ever had this problem? Am I doing
something wrong or this a bug in Sikuli?
my import code looks something like this:
myScriptPath = "Users/pbellamy/browseto_url.sikuli"
if not myScriptPath in sys.path: sys.path.append(myScriptPath)
import browseto_url
Again the import works fine in every other way; all of the code from the
imported scripts is coming over fine, it's just the image files that are
getting left behind somehow.
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.