sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #33193
Re: [Question #268512]: Import Python Module from Jar
Question #268512 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/268512
Status: Needs information => Answered
RaiMan proposed the following answer:
to help you, I need more information about the current
organization/structure/content of your framework (not the code itself,
only folder structure and how the stuff should be used).
the principal approach is
- to have a jar file with the same content as the folder, that would be used without the jar.
- have it at sys.path at runtime
- use import xyz
example:
-- folder1
module1.py
module2.py
-- folder2 # multi-module
__init__.py
module3.py
module4.py
after packing a jar, it's content should be
-- mystuff.jar
module1.py
module2.py
-- folder2 # multi-module
__init__.py
module3.py
module4.py
Be aware: it is not yet supported, to have .sikuli folders packed into
the jar, only plain .py files. If you need images together with your
code like in a .sikuli, you have to organise all images into a folder,
that is packed to the jar as well and made available trough the image
path feature at runtime.
the usage (principally):
sys.path.append("<path-to>/mystuff.jar")
import module1.py
the load() feature of SikuliX is a possible shortcut for the
sys.path.append, but then the jar must be in special places depending on
the Sikuli version.
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.