Run SKL from the command line,set UTF-8,it doesn't work

Asked by DCWOO on 2019-11-07

i run a SKL from the command line,and set like this:
java -Dfile.encoding=UTF-8 -jar sikulix.jar -r 1.skl
it can run,but the console output chinese garbled
the sikulix-ide version is 2.1.0

i want to import some other python modules,
set the sites.txt like this:
D:\Program Files (x86)\python\Lib\site-packages
and then restart the IDE,so i import a module like:from apscheduler.schedulers.background import BackgroundScheduler
it doesn't work:
[error] script [ 1 ] stopped with error in line 10
[error] ImportError ( No module named apscheduler )
[error] --- Traceback --- error source first
line: module ( function ) statement
10: main ( <module> ) from apscheduler.schedulers.background import BackgroundScheduler
[error] --- Traceback --- end --------------

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
RaiMan (raimund-hocke) said : #3

at q1:
this setting only affects files internally loaded by Java.

Output to the commandline (in your case done by Python/Jython print) cannot handle UTF-8.

use uprint() instaed of print or implement your own encoding.

at q2:
run the IDE from command line like this:
java -jar <path-to>\sikulix.jar -v -c
and watch the log on command line.

check the content of sys.path after startup.

DCWOO (qjhpao110) said : #4

thanks so much for reply,
The first problem is solved,that i add 'u' like this:print(u"------"),use this can solved in win7, but it doesn't work in win10.

The second problem:
i have checked the content in the command line that it include the path like this:
[debug] Jython: ***** sys.path
 0: D:\Program Files\sikuli\22.sikuli
 1: C:\Users\Administrator\AppData\Roaming\Sikulix\Lib\
 2: C:\Users\Administrator\AppData\Roaming\Sikulix\Lib
 3: C:\Users\Administrator\AppData\Roaming\Sikulix\Exte
 4: C:\Users\Administrator\AppData\Roaming\Sikulix\Exte
 7: D:\Program Files\Python\Python37\Lib\site-packages
[5846 debug] JythonRunner: ready: version 2.7.1

when i run it:
[error] script [ 22 ] stopped with error in line 15
[error] ImportError ( No module named six )
[error] --- Traceback --- error source first
line: module ( function ) statement
12: base ( <module> ) import six
5: background ( <module> ) from apscheduler.schedulers.base import BaseSche
15: main ( <module> ) from apscheduler.schedulers.background import Backgro
[error] --- Traceback --- end --------------
[debug] RunTime:***** running cleanUp *****

Best RaiMan (raimund-hocke) said : #5

related to the chinese print out I cannot help you. I do not have the environment.

--- import problem:
apparently the import principally works.
The problem is with a sub-module six of apscheduler

The reason might be, that the Python apscheduler module cannot be used with Jython. In most cases the reason is, that it depends on some C-based stuff or native librarioes.
If this is the case, then you have to find another solution.

DCWOO (qjhpao110) said : #6

Thanks RaiMan, that solved my question.