← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #243323]: Is it possible to import a .skl file? If not, workaround?

 

Question #243323 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/243323

RaiMan posted a new comment:
In a private communicationIi suggested the following workaround to
import a .skl:

# get Sikuli’s Filemanager class
import org.sikuli.basics.FileManager as SFm
import os
# get the folderpath the main script is stored
scriptPath = os.path.join(os.path.dirname(os.path.dirname(getBundlePath())))
# get the folder path of a ….skl stored in the same folder (here sub.skl)
sub = os.path.join(scriptPath, "sub.skl“)
# unzip to temp folder (the only option here ;-)
subPath = SFm.unzipSKL(sub)
# put it on sys.path
sys.path.append(os.path.dirname(subPath))
# import it
import sub
# use it
….
# before exit delete it
SFm.deleteFileOrFolder(subPath)

This is necessary, since with the current Sikuli 1.0.1 the Jython 2.5 is
bundled and the Python zip features are introduced with Python 2.6, so
they are not available (so eventually they will be available with
version 1.1.0 which comes with Jython 2.7beta1, that says to be on
Python language level 2.7 - not checked yet)

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.