← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #258525]: getBundlePath() in Windows returns different slash as os.sep

 

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

RaiMan proposed the following answer:
It would help to see a real folder structure and the corresponding code
you are using.

The respective class is org.sikuli.script.ImagePath, but the (differing) Jython API is in API/src/main/resources/Lib/sikuli/Sikuli.py:
e.g. addImagePath(path) is ImagePath.add(path)

generally:
in the image path list the entry at 0 is reserved for the bundle path and might be null/None in situations, where a script is not run by the bundled interpreter.
a given path is only added if it exists.

since internally standard java.io features are used, here the doc snippet about relative path names:
By default the classes in the java.io package always resolve relative pathnames against the current user directory. This directory is named by the system property user.dir, and is typically the directory in which the Java virtual machine was invoked.

this current directory depends on your Eclipse launch configuration (usually the folder containing the main.py).
Since path names containing . or .. are not supported in Sikuli it might be necessary to evaluate an absolute path yourself before using addImagePath(), if the default handling of relative paths does not work.
The new convenience functions in the Jython API might help 
(see http://sikulix-2014.readthedocs.org/en/latest/scripting.html#file-and-path-handling-convenience-functions)

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