[1.0.1] running a 2nd sikuli file after the need to split due to codelenght --- include feature?

Asked by sanjana

Hi,
1. Had to split the script into 2 sikuli files due to code lenght issues. Is ther a way to increase the code length?

2. Is there a command to call one sikuli file from other sikuli file.?
The 2 sikuli files created hav the html scripting for report generation, and the reports ll closed ly at the end of the script..
I dont want to make a function declaration here

It wud b great if u can suggest me a way to increase the code lenght option or secondly for the question 2

Question information

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

-- code length
no, cannot be increased.
Is a buffer lenght restriction (64KB) of the used Jython interpreter.

-- script call for the rest
When running the script from command line, this is the easiest option:

# script1.sikuli
# many lines of code
import os
dir = os.path.dirname(getBundlePath()) # parent folder of script folder
nextSikuli = os.path.join(dir, "script2.sikuli")
setBundlePath(nextSikuli)
execfile(os.path.join(nextSikuli, "script2.py"))

script2.sikuli must be in same folder as script1.sikuli

to get the parent folder in version 1.0.1:
dir = os.path.dirname(os.path.dirname(getBundlePath()))

(this is a non-compat-bug and will be fixed in 1.1.0)

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

This will work in IDE also.

Using execfile() has the advantage over all other possible solutions, that the executed code runs in the context of the main script (all names are known to the executed code).

I think I should implement an include() feature, that handles the sikuli specifics, finds .sikuli scripts on sys.path and uses execfile()

Can you help with this problem?

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

To post a message you must log in.