Runnuble jar file does not created corectly

Asked by vasiliy

I apologize if this question has already been asked.

I use Sikuli 1.1.3
I add Yaml module to sikuli
I add sikulixapi.jar in folder with sikuli.

I want to do runnable jar, but when I try to do this, I have error in IDE:

Compiling C:/Users/user/AppData/Roaming/Sikulix/SetupStuff/scriptCompiled\__run__.py ...
SyntaxError: ("mismatched input 'projects' expecting NEWLINE", ('C:\\Users\\user\\AppData\\Roaming\\Sikulix\\SetupStuff\\scriptCompiled\\__run__.py', 4, 14, 'import Sikuli projects.VKPOST_test_yaml\n'))

I don't find this folder 'SetupStuff' on my PC.

My project is very simple:

import yaml

config = yaml.load(open("C:\Users\user\Documents\Sikuli projects.VKPOST_test_yaml.sikuli\config.yml", 'r'))
print config['address']
openApp (config['address'])
openApp("C:\\Program Files\\Opera\\launcher.exe")
from datetime import datetime, timedelta
date1 = datetime.strftime(datetime.now(), "%d/%m/%Y")
date2 = "01/01/2019"
newdate1 = time.strptime(date1, "%d/%m/%Y")
newdate2 = time.strptime(date2, "%d/%m/%Y")
if(newdate1>newdate2):
    print ("win")
    print newdate1
    print newdate2
else:
    print ("lose")
    print newdate1
    print newdate2
print SCREEN.getH()
print SCREEN.getW()

Can you help me?

Question information

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

If you are talking about the IDE FileMenu entry:
... not longer supported, so I have to leave you alone with that.

--- comments:

- I add Yaml module to sikuli
I guess you are talking about Lib/sikuli in SikuliX appdata:
This helps to run your script, but will not be in the "runnable jar"

- I add sikulixapi.jar in folder with sikuli.
does not help anything and should not be done, to avoid any conflicts

- C:\Users\user\Documents\Sikuli projects.VKPOST_test_yaml.sikuli\config.yml
apparently the space in ...Sikuli projects... makes problems
... and other characters than letters, numbers, hyphen and underscore should not be in .sikuli folder names (at least risky, because there might still be "hidden" bugs).

- folder SetupStuff
is surely a temp folder and might be already deleted ???

Revision history for this message
vasiliy (prusov) said :
#2

Hello, RaiMan.
I solved this problem by this way:

1. I install Sikuli IDE with first option and JRuby (why? I don`t know ... I try this and it`s work)
2. I install sikulixapi in the same folder with Sikuli IDE (it does not work without this)
3. I changed yaml to json, because json coming out of the box.
4. When I create a runnable jar, json file stay external file, which I can change and save.

This worked perfect :)

May by this will be helpfull for someone :)

Listing of my simple test:

import json
with open('C:\\Users\\user\\Documents\\testjson.sikuli\\config.json') as json_data:
    data = json.load(json_data)
openApp(data["address"])
i=0
gt = (data["sites"])
for element in gt:
    print i
    print data["sites"][i]
    i=i+1