[request] sys.path should include PYTHONPATH environment variable (or JYTHONPATH if available)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SikuliX |
In Progress
|
Medium
|
RaiMan |
Bug Description
current state for version 1.1.0:
- PYTHONPATH is ignored
- JYTHONPATH is used if specified and overwrites -Dpython.path which is used if present
still to do
- .pth files should be recognised as well (if in JYTHONPATH/
in any case:
import org.sikuli.
(or deprecated: import org.sikuli.
takes care, that sikulixapi.jar/Lib gets sys.path[0]
-------
available now in 1.1.0 2014-09-17+
in sys.path at script runtime
OS environment PYTHONPATH variable with one or more paths separated by : or ; respectively.
-------
If I want to import Python scripts without manually setting sys.path beforehand (as in an automated testing environment), I set the environment variable PYTHONPATH to where the scripts to be imported are, and sys.path will include these paths.
But that does not happen for Sikuli scripts: os.environ[
Windows 7, 64 bit
Sikuli 1.0.1
description: | updated |
summary: |
- sys.path does not include PYTHONPATH environment variable + [request] sys.path should include PYTHONPATH environment variable |
Changed in sikuli: | |
status: | New → Fix Committed |
importance: | Undecided → High |
assignee: | nobody → RaiMan (raimund-hocke) |
milestone: | none → 1.1.0 |
Changed in sikuli: | |
importance: | High → Critical |
description: | updated |
description: | updated |
description: | updated |
Changed in sikuli: | |
milestone: | 1.1.0 → 2.0.0 |
importance: | High → Medium |
Changed in sikuli: | |
milestone: | 2.0.0 → 2.1.0 |
status: | Fix Committed → In Progress |
Should this be PYTHONPATH or JYTHONPATH? I would assume JYTHONPATH since Jython itself does not use the PYTHONPATH variable. I believe this was done because not all modules are compatible with both interpreters.
In my project I used the JYTHONPATH to specify the location of the Jython top level packages (I do not want to mix Jython and CPython packages since our framework uses both and neither is compatible with the other interpreter) and sikuli is able to find them. I confirmed this by first opening a Jython interactive session and verifying using help('modules') to verify my package was available. I then used a sikuli interactive session from sikuli-script.jar to print the modules again and they are the same.
I can open a new defect if necessary, but a related issue is the use of a .pth file verified in the same way. When we deploy our execution lab machines we are planning on setting the module paths via a .pth file (one for Python and a separate one for Jython) so it can be updated without changing the system configuration. When the file is included in the Jython site-package folder I can create a Jython interactive session and use help('modules') and see all of the JYTHONPATH modules, as well as the modules in my .pth file. When I do the same through the sikuli interactive session I am missing the files outlined in the .pth file.