X-1.0rc3 (931): Windows7: Chinese: Crashes on capture and images not found --- problem: unicode in filenames

Bug #862060 reported by Edwin Yip
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
SikuliX
In Progress
High
RaiMan

Bug Description

*** related bug: bug 512476

*** workaround
--- make sure all filenames do not contain unicode characters
--- move Sikuli's tempdir to outside of your user environment: change Java system property java.io.tmpdir to do that. Try to run java with -Djava.io.tmpdir=[the temp path you like].
--- store your script in a location whose absolute path does not contain unicode characters

------------------------------------------------

Sikuli is so great! When the first time I heard about it it was only available on Mac, "what a pity!", I said. I just now noticed it supports Windows now! So I tried it. Unfortunately, it doesn't seem like my windows 7 Ultimate (Chinese) 64bit.

I followed the getting started tutorial and tried capturing a portion of my screenshot (the Start button), once I selected a rectangular area, the program exited abnormally, without any error message. The result is the same no matter I clicked the capture screen toolbar button, or clicked the "Click" function name on the left list.

So I also tried using another program to capture the Windows Start menu button and saved it to my disk, then manually added the following script:

Click(<my-previously-saved-png-image>).

And the log window shows the following:

[info] Sikuli vision engine loaded.
[info] Windows utilities loaded.

[info] VDictProxy loaded.

[error] 被停止 (translation: stopped)
[error] 第1行发生错误 (translation: error in line 1)
[error] 错误信息 (translation: error message): Traceback (most recent call last):
 File "C:\Users\????\AppData\Local\Temp\sikuli-tmp2386320233862351632.py", line 1, in
 click("start button.png")
 Line 1, in file C:\Users\????\AppData\Local\Temp\sikuli-tmp2386320233862351632.py

 at org.sikuli.script.Region.handleFindFailed(Region.java:420)
at org.sikuli.script.Region.wait(Region.java:511)
at org.python.proxies.sikuli.Region$Region$0.super__wait(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)

org.sikuli.script.FindFailed: FindFailed: can not find start button.png on the screen.
 Line 1, in file C:\Users\????\AppData\Local\Temp\sikuli-tmp2386320233862351632.py

Tags: filenames
Revision history for this message
RaiMan (raimund-hocke) wrote :

- uninstall your sikuli using Windows software uninstall feature
- reinstall the latest version (rc3) using the installer
- start Sikuli using Sikuli-IDE.bat or Sikuli-IDE-w.bat

If you face any problems, get the latest build from http://sikuli.org/hudson
(it is a zip. unzip and replace the contents of folder Sikuli X with content of Sikuli-IDE from zip)

Revision history for this message
Edwin Yip (edwin-yip) wrote :

@RaiMan,

Thanks, did exactly as you instructed, unfortunately, it's the same problem with the last build r931...

BTW, my Windows user name is in Chinese, does it matter?

And I've done some system optimization which involved disabling some services (my system is running without problem, though), does it matter?

I really want to use sikuli ............

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

Sorry, no idea. But the username might be a problem.

Save your script first to a folder not containing any unicode characters and then run it again.

Run the saved script using Sikuli-IDE.bat -r your script.sikuli.

I have notified the developer about this situation, he is more competent in such cases (sorry, I am german ,-).

Revision history for this message
Edwin Yip (edwin-yip) wrote :

@RaiMan,

I tried switching to another Windows login that's in English, and it worked!

And I wish you can fix this problem...

RaiMan (raimund-hocke)
summary: - Crashed on Windows 7 64bit Ultimate
+ X-1.0rc3: Windows7: Chinese: Crashes on capture and images not found
summary: - X-1.0rc3: Windows7: Chinese: Crashes on capture and images not found
+ X-1.0rc3 (931): Windows7: Chinese: Crashes on capture and images not
+ found
Revision history for this message
Tsung-Hsiang Chang (vgod) wrote : Re: X-1.0rc3 (931): Windows7: Chinese: Crashes on capture and images not found

May be the same problem as the Bug #512476.
I guess the problem was caused by the non-ascii user name. When capturing a screenshot, sikuli creates a temp file in the user's directory, which could be unaccessible if the path to the directory has non-ascii chars.

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

I could reproduce the error on my german Windows 7 Sikuli build 927

The problem are the unicode characters in the image filename.

having e.g. the utf-8 character "AD00" (some Hangul whatever ;-) shows the character in the IDE environment as compound Hangul letter.

When using it as part of a filename (e.g. absolute image path), in the windows filename, this one unicode character is replaced by extended ascii characters (in this case ê` ), with the effect that the find() says: not found on screen with the correct filename.

to reproduce:
imgx = "afilename containing non ascii.png"
img = capture()
import shutil
shutil.move(img, getBundlePath()+"\\"+imgx) # works only if imgx does not exist yet

***** Conclusion in this case: If the script would be saved in a path containing only ascii characters and the image filenames too only consist of ascii characters, then it should work.

Revision history for this message
Edwin Yip (edwin-yip) wrote :

Is there a workaround - any chance to change the temp folder sikuli uses (I assume it reads the value from the registry or something)? If yes, I can set it to a folder which contains no none-ASCII characters.

Revision history for this message
Edwin Yip (edwin-yip) wrote :

@RaiMan,

You conclusion in that case might be right, but one still can use the 'take screenshot' functions of the IDE, if his/her Windows login account contains Unicode characters.

Revision history for this message
Tsung-Hsiang Chang (vgod) wrote :

You can change a Java system property java.io.tmpdir to do that. Try to run java with -Djava.io.tmpdir=[the temp path you like].

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

@ Edwin

That is true and must be so, since the capturing is handled in the Sikuli frontend which talks utf-8. The problem only exists later, when Sikuli tries to recall the image file whit find operations.

So you might capture with a unicode login account, but you should assure (e.g. preferences image naming), that the final paths to the stored image files do not contain any unicode characters.

summary: X-1.0rc3 (931): Windows7: Chinese: Crashes on capture and images not
- found
+ found --- problem: unicode in filenames
RaiMan (raimund-hocke)
description: updated
RaiMan (raimund-hocke)
Changed in sikuli:
status: New → In Progress
assignee: nobody → RaiMan (raimund-hocke)
RaiMan (raimund-hocke)
tags: added: filenames
RaiMan (raimund-hocke)
Changed in sikuli:
importance: Undecided → Medium
importance: Medium → Low
RaiMan (raimund-hocke)
Changed in sikuli:
importance: Low → High
milestone: none → x1.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.