[1.1.4] Problems with image file paths containing blanks

Asked by Sahil Doshi

I am trying to wait for one pattern generated by passing image path.
Pattern p = new Pattern("C:\\program files(86x)\\sikuli\\images\\image.png");
Screen s = new Screen();
s.wait(p);

and when it is tring to format "find fail" exception message it it throwing below error:

Exception in thread "main" java.util.UnknownFormatConversionException: Conversion = 'W'
 at java.util.Formatter$FormatSpecifier.conversion(Formatter.java:2691)
 at java.util.Formatter$FormatSpecifier.<init>(Formatter.java:2720)
 at java.util.Formatter.parse(Formatter.java:2560)
 at java.util.Formatter.format(Formatter.java:2501)
 at java.util.Formatter.format(Formatter.java:2455)
 at java.lang.String.format(String.java:2940)
 at org.sikuli.script.Image.toString(Image.java:427)
 at java.util.Formatter$FormatSpecifier.printString(Formatter.java:2886)
 at java.util.Formatter$FormatSpecifier.print(Formatter.java:2763)
 at java.util.Formatter.format(Formatter.java:2520)
 at java.util.Formatter.format(Formatter.java:2455)
 at java.lang.String.format(String.java:2940)
 at org.sikuli.script.FindFailed.createErrorMessage(FindFailed.java:173)
 at org.sikuli.script.Region.wait(Region.java:2328)

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
Sahil Doshi (sahil13) said :
#1

I dig into it and find out It is failing while calling the toString() method of Image class.

the reason behind it is :

imageName ="C:/program%20files(86x)/sikuli/images/image.png"

in toString,

String.format((this.imageName != null ? this.imageName : "__UNKNOWN__") + ": (%dx%d)", this.bwidth, this.bheight)

it is failing because of "%20" in imageName

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

what version of SikuliX?

Revision history for this message
Sahil Doshi (sahil13) said :
#3

Sikulixapi Build 270

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

Supposing we are talking about SikuliX 1.1.4 sikulixapi.jar build #270.

Has to be completely revised. Thanks for finding.

workaround: store the images in a folder whose path does not contain blanks.

BTW: generally it is not a good idea, to store private stuff in the Windows program folders. Might lead to access problems.

Revision history for this message
Sahil Doshi (sahil13) said :
#5

when can I expect this to be fixed?

Revision history for this message
Sahil Doshi (sahil13) said :
#6

Thanks RaiMan, that solved my question.

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

somewhen during next week - other priorities currently.

Revision history for this message
Sahil Doshi (sahil13) said :
#8

Is there any problem or bug which I can follow to get an update on this issue when it will get resolved?

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

You will get a note on this thread.