sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #30609
Re: [Question #262180]: How i can import json module in my scripts
Question #262180 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/262180
Chp gave more information on the question:
I no it does not get imported jar package, please help!
I run my script from the command line: "cmd": ["C:\\Program Files (x86)\\Java\\jre6\\bin\\java.exe", "-jar", "C:\\Program Files (x86)\\Sikuli X\\sikuli-script.jar", "$file_path"]
"$file_path" = D:\autotest\dragon_world\TestCases\Test\Test.sikuli
my file structure:
http://joxi.ru/QY2LlG5i75ey26
http://joxi.ru/lbrRgbZi7vnQm1
http://joxi.ru/L4AkLxqCoqKjrq
my code:
# coding=cp1251
from os.path import dirname,join
from os import putenv
TEST_DIR = dirname(dirname(dirname(getBundlePath())))
ROOT_DIR = dirname(TEST_DIR)
putenv('TEST_DIR', TEST_DIR)
putenv('ROOT_DIR', ROOT_DIR)
sys.path.append(TEST_DIR)
sys.path.append(ROOT_DIR)
sys.path.append("""D:\\autotest\Core\json-simple.jar""")
from Core import Common
from TestCases.DW import DW
print('TEST_DIR',TEST_DIR)
print('ROOT_DIR',ROOT_DIR)
print('SYS.PATH',sys.path)
import org.json.simple.parser
exit(0)
trace:
[info] Sikuli vision engine loaded.
[info] Windows utilities loaded.
[info] VDictProxy loaded.
Check log dir D:\autotest\dragon_world\Log\2015_02_18
('TEST_DIR', u'D:\\autotest\\dragon_world')
('ROOT_DIR', u'D:\\autotest')
('SYS.PATH', ['C:\\Program Files (x86)\\Sikuli X\\Lib', 'C:\\Program Files (x86)\\Sikuli X\\sikuli-script.jar\\Lib', '__classpath__', '__pyclasspath__/', 'D:/autotest/dragon_world/TestCases/Test/Test.sikuli/', 'D:/autotest/dragon_world/TestCases/Test/', u'D:\\autotest\\dragon_world', u'D:\\autotest', 'D:\\autotest\\Core\\json-simple.jar', '.'])
[error] Can't run this Sikuli script: D:\autotest\dragon_world\TestCases\Test\Test.sikuli
ERROR:
File "D:\autotest\dragon_world\TestCases\Test\Test.sikuli\Test.py", line 22, in <module>
import org.json.simple.parser
No module named json [screenshot]20150218_131037.jpg[/screenshot]
[error] Can't run this Sikuli script: home=1java.lang.StringIndexOutOfBoundsException: String index out of range: -1
[error] Can't run this Sikuli script: eoe=1
at java.lang.String.substring(Unknown Source)
at org.sikuli.script.ScriptRunner.getPyFrom(ScriptRunner.java:109)
at org.sikuli.script.ScriptRunner.runPython(ScriptRunner.java:103)
at org.sikuli.script.SikuliScript.main(SikuliScript.java:115)
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(Unknown Source)
at org.sikuli.script.ScriptRunner.getPyFrom(ScriptRunner.java:109)
at org.sikuli.script.ScriptRunner.runPython(ScriptRunner.java:103)
at org.sikuli.script.SikuliScript.main(SikuliScript.java:115)
[Finished in 5.6s]
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.