← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #243323]: How To import a .skl file --- workaround

 

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

    Assignee: None => RaiMan

Description changed to:
--- a workaround for Sikuli 1.0.1

Here a useable function, to make a .skl ready to be imported:

def loadSKL(name, dir = None):
    import org.sikuli.basics.FileManager as SFm
    import os
    if not dir:
        dir = os.path.join(os.path.dirname(os.path.dirname(getBundlePath())))
    sub = os.path.join(dir, name + ".skl")
    spath = os.path.dirname(SFm.unzipSKL(sub))
    if sPath:
        sys.path.append(spath)
        return true
    return false

*** usage for a mymodule.skl in same directory:

loadSKL("mymodule")
import mymodule

usage for a mymodule.skl in same directory:

loadSKL("mymodule", "some-absolute-path-to-folder-containing-the-skl")
import mymodule

------------------------------------------------

Hey there,

Is it possible to import a .skl file? I understand that the .skl file is
a compressed version of the .sikuli file.

I have a requirement to mask the code found in the .sikuli file as well
as the images, hence bringing a .skl file into the picture. However, the
main script I'm running needs to IMPORT the .skl file. Is that possible?

If it is - how do I go about doing it?

If it isn't - what is a workaround I can employ to achieve this?

At present, what I'm thinking of is to password-protect a zip file, then
unzip it with python, import the script and delete the unzipped file.

P.S. I'm pretty sure you can reverse engineer the .skl file and even
break through the workaround I'm thinking of right now, but if the user
wishes to go to that length to get the script, they can have it. This is
just a precautionary measure to discourage the average user.

Thanks.

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