sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #50089
Re: [Question #677405]: Organizing sikuli scripts into packages.
Question #677405 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/677405
Status: Answered => Solved
Dillon confirmed that the question is solved:
Thank you very much for the quick reply RaiMan. Your hard work is
greatly appreciated. I thought I'd share that I successful in my
attempts of getting python to recognize the modules within the seperate
sikuli bundles ny adding each sikuli bundle to the __path__ within each
__init__.py file. Maybe this should be added to the documentation?
# __init__.py
from sikuli import *
import os
# Get the base path.
base_path = os.path.dirname(os.path.realpath(__file__))
# Since python packages only recognize .py files
# in the same directory, we need to add the .sikuli
# folders to the __path__. This will add the .py
# files inside them to the package so that we can
# reference them directly.
for dir in os.listdir(base_path):
if ".sikuli" in dir:
path = os.path.join(base_path, dir)
__path__.append(path)
addImagePath(path)
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.