sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #06547
Re: [Question #177227]: Sikuli IDE support open python
Question #177227 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/177227
Status: Open => Answered
RaiMan proposed the following answer:
--- from sikuli import *
is only needed in scripts that are imported (FirefoxSettings.sikuli in this case) and only if you use any Sikuli API features.
--- the .py files
should never be touched as long as you are using the Sikuli IDE to edit the Sikuli scripts. And then we should always talk about a Sikuli script (since this is the bundle of code and images contained in a folder with suffix .sikuli).
The .py files are only of interest in very special situations and when you decide to use other IDE's like Eclipse or Netbeans to edit and run the Python code.
so your structure is like this:
- automation
- Site.sikuli
- FirefoxSetting.sikuli
Now the solution, if you decide to have all your imports in the same
directory as the main script:
# Site.sikuli
# preferably in first line
from FirefoxSettings import *
This makes available all names in FirefoxSettings without the need to
qualify them. This is ok, if you are sure there will be no naming
conflicts.
To avoid conflicts, use:
import FirefoxSettings
but then you have to qualify the names from FirefoxSettings:
x = FirefoxSettings.some_name_from_FirefoxSettings
This is all, since Sikuli will look for imports in the same directory
the main script lives in.
Adding the folder containing your imports to sys.path is only required,
when this folder is not the same as your main script lives in.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.