Suddenly unable to load images (files) on Linux Ubuntu

Asked by Valerij

Hello. I have been using Sikuli as a library within my Java program for longer than a year. After a few months break, i launched my program only for it to thrown an error, that it is unable to load any of the image files. Same code also is running on a Windows machine and is not experiencing any such problems.

My code, that causes the problem, is basically this:

BufferedImage img = someImage(); //we have some bufferedImage
Finder objFinder = new Finder(img);//and we create a Finder, using the said image
objFinder.find("someFile"); //we try to find a sub-image, which is a file named "someFile", within the bufferedImage
while(objFinder.hasNext){
     //do something
}

as soon as objFinder.find is invoked, the error is displayed
[error] image: could not be loaded: file: home/ubuntu/completeFilePath/to/someFile.png

the file path is correct and the same code runs on a windows machine, and once ran on this Linux machine without such error

I tried installing older versions of the program, that i am sure worked perfectly, only for them to display same error
i completely reinstalled my operating system, installed java jdk8, netbeans 8.2, all the dependencies for sikuli like opencv and tesseract, only to be displayed same error

What could be the cause of it?

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

what version of SikuliX?

how does the string someFile in objFinder.find("someFile") look like?

[error] image: could not be loaded: file: home/ubuntu/completeFilePath/to/someFile.png

the mentioned filename should start with a / !?

Revision history for this message
Valerij (rykenn) said :
#2

Thank you for your response.

>what version of SikuliX?
I have tried both 1.1.3 and 1.1.4 versions of sikulix

>how does the string someFile in objFinder.find("someFile") look like?
for example, i have OkBtn.png file in MainMenu folder, in such case, the string will look like "MainMenu/OkBtn"

https://imgur.com/a/yCOyiaw

here is an image of a method that uses such code

The images in my file system are divided by platform and game, each having its own folder

for example, in given image, the String could be "iOS/GameName/OkBtn"

>the mentioned filename should start with a / !?
yes, my bad
the correct error is
[error] image: could not be loaded: file:/home/userName/Desktop/projectFolder/PlatformFolder/GameFolder/fileName.png

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

the best way, to make your program robust for locating images is

ImagePath.setBundlePath(someBaseFolder)

where someBaseFolder is a path to a folder where the relative image file names can be found.

Sorry for the inconvenience, but the image file name handling (and file name handling generally) in SikuliX is not consistent all over the place (to be polite to the developer ;-).

Revision history for this message
Valerij (rykenn) said :
#4

I did try setting bundle path with given method, before asking this question. It didnt work.
The puzzling part, that the error displays a correct path to the image, stating it cant be loaded

Currently, ImagePath.getBundlePath() returns "/home/userName/Desktop/projectFolder" and setting it again to same value wont change much

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

ok, I will later check on Ubuntu with 1.1.4

A solution might be available only during Monday.

Revision history for this message
Valerij (rykenn) said :
#6

one more thing!
this code did work at some point, but after something happened, it shows this error, even with older versions of my code, which worked. the problem persisted even after freshly reinstalling linux and setting up ONLY things that are needed to run sikulix with java

Can you help with this problem?

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

To post a message you must log in.