The script searches for image files in other directory

Asked by Yu

Hello,
yesterday I updated from May version of sikuli to the new one and the scripts that were running before begin to fail. Right now my problem is that during test case execution it looks for image files not in its home directory, but in other one:

I've got a file structure
c:\test\sikuli\bin <- here are .jars and runIDE.cmd
c:\test\sikuli\bin\libs <- sikuli created directory with dlls
c:\test\sikuli\testcases <- the folder containing all the testcases as *.sikuli folders:
...\setup.sikuli
...\constants.sikuli
...\mytestcase.sikuli
...\mytestcase.sikuli\image.png

mytestcase text:
====
libPath="c:\\test\\sikuli\\testcases\\" <- had to import these 3 lines after sikuli update, because it refused to see modules anymore, though they're in the same folder
if not libPath in sys.path:
    sys.path.append(libPath)
import setup
import constants

def someFunction(param):
    click(constants.butOK)
    click(wait("image.png")) <- the error happens here
    return 0

setup.doLogin()
someFunction("someValue")
exit(0)
====

When I run it, it calls someFunction, goes up to the marked line and crashes with error:
[error] image.png looks like a file, but not on disk. Assume it's text.
[error] Region.find(text): text search is currently switched off
[error] script [ mytestcase ] stopped with error in line 13
[error] FindFailed ( Text search currently switched off )

so it doesn't see the image file in its own directory. However, when I copy that file into c:\test\sikuli\testcases\setup.sikuli\, the script starts to work correctly! This happens now with every script I have

Please advice, what's done wrong? I cannot move the images from all the scripts into one folder, there's tons of them

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Yu
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

That sounds really weird, I will check instantly whats going on there.

Possible to switch back to 1.0.0 ?

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

I made some tests and checks.

There is some problem with the pathnames in Windows in some cases, that I have to check deeper.

I found one situation that worked:

In the path down to the folder there are some \x combinations that are interpreted as special characters, which leads to corrupted path names in some places.

As a workaround, you can mask the first character after a \ using an underscore (t has to be masked e.g., s works)

So in your case
c:\_test\sikuli\_testcases

 should work as expected (no append to sys.path needed)

I will fix this as fast as possible.

Revision history for this message
Yu (yuri-litovchenko) said :
#3

prefixed every directory with _...
commented out sys.path.append...
got a few
[error] NameError ( global name 'FindFailed' is not defined )
(I use try... except FindFailed in my scripts)

hooray-hooray! after uncommenting it began to work!

so in my case it was an issue with one of the following sequences in path:
\v
\s
\b
\t

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

thanks for your patience and contribution ...
... and thanks for the "bad" characters ;-)