sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #02995
[Question #159700]: how to import all the sikuli files in one directory (myLib folder)
New question #159700 on Sikuli:
https://answers.launchpad.net/sikuli/+question/159700
I tried to implement the "Another example: Importing from the same directory" in page
"Global Functions and Features".
Looking in the forum i couldn't find solution: these answers don't help:
136832 Calling a common Function Library
138472 Trying to use system path for sikuli script and import it in other scripts.
and reading more answers just got more confused.
One of my tries are below:
"myLib.Sikuli" folder and "ImportMyLib.sikuli" file in C:\Program Files\Sikuli
"ImportMyLib.sikuli" content:
import os
# get the directory containing your running .sikuli
myPath = os.path.dirname(getBundlePath())
if not myPath in sys.path: sys.path.append(myPath)
# now you can import every .sikuli in the same directory
import myLib
-------------------------------------------------------------------------
when ImportMyLib.sikuli run, the message displayed is:
[error] Stopped [error] An error occurs at line 8 [error] Error message: Traceback (most recent call last): File "C:\Users\Pablo1\AppData\Local\Temp\sikuli-tmp406801296734407928.py", line 8, in import myLib File "C:\Program Files\Sikuli X\sikuli-script.jar\Lib\sikuli\SikuliImporter.py", line 42, in load_module File "C:\Program Files\Sikuli X\sikuli-script.jar\Lib\sikuli\SikuliImporter.py", line 22, in _load_module ImportError: No module named myLib
thanks in advance for any help
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.