Import Lib/site-packages the same way as -i option

Asked by Techno.Scavenger

When running <SikuliX>/runIDE.cmd -i, all my manually copied egg files in <SikuliX>/Lib/site-packages are available in sys.path. But running the IDE or runIDE.cmd -r does not add site-packages to sys.path.

Can -r and -i behave the same way in terms of updating sys.path?

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

With Sikuli you should have your own modules in <SikuliX>/Lib, since this works with all variants.

Revision history for this message
Mark (mark-loyzer) said :
#2

Hey, what about for .pth files? I am trying to register a file-system path but haven't had any luck.

Revision history for this message
RaiMan (raimund-hocke) said :
#3

@Mark
what exactly are you talking about?

Revision history for this message
Mark (mark-loyzer) said :
#4

I am trying to add a path to python's module search path. Instead of writing in every file:

myPath = "path/to/user/defined/modules"
if not myPath in sys.path: append(myPath)

I want to just add myPath to python's default module search path so it will check the path by default. I've tried changing the PYTHONPATH environment variable and using site-packages but neither have worked. I am on Windows 7.

Any ideas?

Revision history for this message
RaiMan (raimund-hocke) said :
#5

@Mark
path-to-sikuli-xxxx.jar/Lib is always in sys.path automatically, when using Sikuli's bundled Jython.

So for version 1.0.1 it is
path-to-setup-folder/Lib
(the folder containing the setup Sikuli stuff)

for RC3
c:\Program Files\Sikuli X\Lib

the folder is usually not there, so it has to be created.

Revision history for this message
Mark (mark-loyzer) said :
#6

Is there any way to put them in a different folder? It doesn't really make sense for me to use those folders.

Revision history for this message
RaiMan (raimund-hocke) said :
#7

@Mark
You might try JYTHONPATH environment variable, since we are running Jython not Python.

Revision history for this message
Mark (mark-loyzer) said :
#8

Thanks RaiMan, using the (user) Environment variable 'JYTHONPATH' worked.

Can you help with this problem?

Provide an answer of your own, or ask Techno.Scavenger for more information if necessary.

To post a message you must log in.