import failed in .skl file

Asked by Garima Kumar

Hello team,

i have a scenerio,
i have 2 .sikuli files at folder: e:\Garima\testCase
1) StepToPerform.sikuli
2) logFileGeneration.sikuli

in first file i have a statement "import logFileGeneration"
i have converted stepToPerform.sikuli to ExecuteStep.skl

Now i am executing this .skl file from command prompt, its giving me an error saying
[error] importError(No module named logFile generation)

i tried adding these line in StepToPerfoem.sikuli

myScriptPath = os.path.dirname(getBundlePath())
if not myScriptPath in sys.path:
    sys.path.append(myScriptPath)
import logFileGeneration
reload(logFileGeneration)
from logFileGeneration import *

still the same error i got

i tried putting "sikuli import *" in logFileGeneration.py file as well.

if possible provide a peace of code to resolve my problem

Regards and Thanks
Garima

Question information

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

With a .skl script all the bundle path related information is no longer true with respect to the place, where the .skl is located, since at runtime it is unzipped to a temp folder as a runnable --temp--.sikuli and run from there.
So in a .skl you have no chance, to get the folder, where the .skl is stored.
If you run it being in the same folder as the .skl, you can use:
workDir = java.lang.System.getProperty("user.dir")

If this is not the case, you might try to hand over the path as a parameter or even hard code it.

The reason: a .skl was intended to be self contained with no need for anything outside the .skl package.
.skl is deprecated and will be replaced by another concept in the next version (... .skl witll be runnable, but no longer creditable and can be converted to the new packaging concept).

What is your expected advantage over using .sikuli when using .skl?

If your intention is to have a self contained package containing everything needed, you have to place the imported .sikuli into the main .sikuli folder before making a .skl, since then everything will be available in the temp folder at runtime.

But if your imported stuff is intended to be reusable from other scripts also, this is of course a contradictory solution ;-)

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

Grrrr, autocorrect go to hell ;-)

(... .skl will still be runnable, but can no longer be created, and can be converted to the new packaging concept).

Can you help with this problem?

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

To post a message you must log in.