Parameter and imagepath escape characters

Asked by patrick bateman

Hello, I am having trouble understanding how paths work with Sikuli and Jython.

My project is set up into "threads" which execute high level test automation, and "apps" which deal with interacting with the actual programs running on the computer.
The folder structure is as follows:

(There are many apps and threads, but this information is not super important.)

In my threads I import apps in order to interact with only the programs that thread needs, and keep my code clean. Of course, at the top of each file I have 'from sikuli import *' as instructed.

My problem lies in the following: When I am working in threadAgile, and try to import appAgile, I get two errors:
[ERROR Commons] parameter(main: C:\Users\blahblahblah\main\Applications□ppAgile.sikuli, sub:null)
[ERROR Commons] makeURL: mainFile.GetCanonicalFile().toURI().toURL(): C:\Users\blahblahbla\main\Applications□ppAgile.sikuli (The filename, directory name, or volume label syntax is incorrect)

It appears that \a in the file path is being replaced with a unicode alert character. Sikuli can not find any of the images I inserted in appAgile because of this, and all finds end up failing. What is even more strange is that despite all the app's names starting with "app" this issue only happens with appAgile.

To make things even worse, I have tried running threadAgile on two different versions of Sikuli, 2.0.5 and 1.1.0. On both versions I get the ERROR Commons printout in the console. But in version 1.1.0 it can find the images, and in version 2.0.5 it can not.

If you have any ideas or guidance on how to fix this pathing issue, I would greatly appreciate it. Thank you.

Question information

English Edit question
SikuliX Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :

Please give me a sample code how you do the import.

Revision history for this message
Manfred Hampl (m-hampl) said :

How do you access the appAgile directory from inside the threadAgile script?
What is the exact text for setting up imagepath and the import statement?
You may have to use double backslashes or raw strings. See FAQ #1739

Revision history for this message
patrick bateman (mdac) said (last edit ):

In threadAgile my imports look like this:

from sikuli import *
import os
import datetime

appPath = "C:\Users\blahblahblah\main\Applications"
if not appPath in sys.path:

import appAgile
reload (appAgile)

import appETC
reload (appETC)

If I add a 'print appPath' in there, it prints the correct path.

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

ok, as Manfred already mentioned:



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

With 2.0.5 you have the option to use the sites.txt file to specify import locations.

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

... and with 2.0.5 the reload() is no longer needed.

Revision history for this message
patrick bateman (mdac) said :

Thank you for your prompt replies. I tried both the site-packages method, and the escape character method and neither worked.

In trying to verify the problem some more, I noticed it is not exclusive to appAgile. Some, but not all apps have an issue where they can not load the images. But the behavior remains consistent, where in 2.0.5 can not find the images and I get a findFailed exception and a bunch of 'ImagePath: Find: Not there:<imagename>' messages in the console.
When I run the same script with 1.1.0, it works fine and can open the image files to search for them.

I am working on this project with a few others, I asked someone else to try to replicate the issue on their machine, using the same code after syncing with git. They had no issues with Sikuli 2.0.5 or 1.1.0. It must be my machine. I am still puzzled by this.

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

Then you have to compare your Windows flavour/setup with those of the others.
There must be some thing special with your Windows version.

Hope you get around this nasty problem.

Can you help with this problem?

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

To post a message you must log in.