addImagePath working on a Pc and not in another

Asked by matteoa on 2019-04-11

on my development Pc:
I have a folder at the same level of the .sikuli folder that contains my script that contains a set of images.
To access them I have put this in the script:
And it works perfectly.
In the "production" pc :
i run the same script in a different location, but always with the Image repository folder at the same level of the script, and I have:
[error] ImagePath: add: not valid: ..\ECUImg

I tested using absolute path instead of absolute and it worked well, so I suppose access right et cetc are ok but I'd like to remain "relocatable"...
TO eliminate some possibilities, in both pc the folder exists, withouth spaces in path and are writable by everybody.

Any idea?
Thanks in advance
P.s. I'm currently not using the last version of Sikulix since I have a problem with newer versions of it.

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
matteoa (matteoa) said : #1

Hello all,
I solved the problem by using this:
It works on both pc.
I'm ok now, but I think the problem I had is worth an explanation.
Thanks in advance

RaiMan (raimund-hocke) said : #2

LOL, 2Fast4me ;-)

had the same idea, after being sure, that the dotted path notation is not supported by addImagePath().

The problem always is: what is the base folder, when you say ../some/what/ever?

Usually it is the working folder.

But I will check.

matteoa (matteoa) said : #3

Thanks RainMan!
Yes, I was supposing that the base folder was the working folder, I tried on my pc and it was ok, then I went to the production pc and...
Let me know
Thanks again for your prompt support!

P.s. the reason for which I'm not using the last version is described in question here:

Best RaiMan (raimund-hocke) said : #4

I think it makes sense, when saying in a script

or any other relative path, that it should be relative to the script folder's location.

The rule might be:
- if there is a bundlepath (which is the case with scripts)
- then relative paths should be relative to the script folder's location

I will let this idea cook over night.

Thanks for reporting

BTW: instead of

os.path.join(getParentPath(), "ECUImg")

matteoa (matteoa) said : #5

Thanks RaiMan, that solved my question.