[2.0.x] Batch env paths are not considering in Sikuli IDE

Bug #1865423 reported by K J R KISHORE KUMAR REDDY
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SikuliX
Won't Fix
Undecided
RaiMan

Bug Description

i have set below path and try to import modules from below path not working
SET PATH=%c:\test_path%;%PATH%

Note: SikuliIDE 1.1.3 is working but latest releases its not working

Revision history for this message
RaiMan (raimund-hocke) wrote :

I do not understand, how this should have worked in 1.1.3.

Do you have an example?

this looks really odd:
%c:\test_path%

Revision history for this message
K J R KISHORE KUMAR REDDY (kjkishorekumar) wrote :

I am launching SikuliX using below bath file and after launching i am import modules from "lib_path" directory

@echo off
setlocal ENABLEDELAYEDEXPANSION
set mypath=%cd%
set WSPath=%mypath%
set lib_path=%mypath%
set extension_path=%mypath%
call set WSPath=%%WSPath:\SikuliX=% %%%
call set lib_path=%%lib_path:\SikuliX=% %\SikuliX\Lib%%
call set extension_path=%%extension_path:\SikuliX=% %\SikuliX\Extensions%%
SET PATH=%lib_path%;%extension_path%;%PATH%
java -jar %mypath%\sikulix.jar

RaiMan (raimund-hocke)
Changed in sikuli:
status: New → In Progress
importance: Undecided → High
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → 2.0.4
summary: - Bath env paths are not considering in Sikuli IDE
+ [2.0.x] IDE/API jars from commandline: should use actual environment
RaiMan (raimund-hocke)
description: updated
Changed in sikuli:
status: In Progress → Confirmed
Revision history for this message
RaiMan (raimund-hocke) wrote :

I have turned everything back.

The actual environment is indeed respected in the IDE, when run from a commandline like you have.

So you now have to tell me what you mean by:

... try to import modules from below path not working

How do you do that?
code example

Changed in sikuli:
status: Confirmed → Invalid
status: Invalid → Opinion
importance: High → Undecided
milestone: 2.0.4 → none
summary: - [2.0.x] IDE/API jars from commandline: should use actual environment
+ [2.0.x] Batch env paths are not considering in Sikuli IDE
description: updated
Revision history for this message
K J R KISHORE KUMAR REDDY (kjkishorekumar) wrote :

Hello RaiMan,

I want to Bath env paths are to be considering in Sikuli IDE so that i can place all my sikuli folder inside that path and i can able to import those sikuli folder in IDE

SikuliIDE 1.1.3 is have above behavior

Revision history for this message
RaiMan (raimund-hocke) wrote :

I understood that already.

But I need a script code example that worked in 1.1.3, since I really do not know what you are doing in the IDE.

Revision history for this message
K J R KISHORE KUMAR REDDY (kjkishorekumar) wrote :

create below folder SikuliX,"SikuliX\Lib" in c drive

C:\SikuliX
C:\SikuliX\Lib

place Sikulix.jar file in "C:\Sikuli" and create one test.sikuli in "C:\Sikuli\Lib" folder

i am launch sikuli using below bath file:

@echo off
setlocal ENABLEDELAYEDEXPANSION
set mypath=%cd%
set lib_path=%mypath%
call set lib_path=%%lib_path:\SikuliX=% %\SikuliX\Lib%%
SET PATH=%lib_path%;%PATH%
java -jar %mypath%\sikulix.jar

In sikuli ide type below code and run

from sikuli import *
import test

issue test folder is not importing

Revision history for this message
RaiMan (raimund-hocke) wrote :

ok, thanks. I will check.

Changed in sikuli:
status: Opinion → In Progress
importance: Undecided → Medium
milestone: none → 2.0.4
Revision history for this message
RaiMan (raimund-hocke) wrote :

ok, the situation is clear.

From the beginning I did not understand the reason behind all this set and %% stuff.

This simply works in 1.1.3:

- put the sikulix.jar in a folder C:\SikuliX
- put a test.sikuli into a folder C:\SikuliX\Lib
- double-click the sikulix.jar in the explorer
- the IDE starts up

running the one-liner
for e in sys.path: print e

you will get:
<user-home>\Dropbox\_SXSupport\_A_test_path\testMain.sikuli
<user-home>\AppData\Roaming\Sikulix\Lib\site-packages
<user-home>\AppData\Roaming\Sikulix\Lib
C:\SikuliX\Lib
C:\SikuliX\sikulix.jar\Lib
__classpath__
__pyclasspath__/

--- the reason behind:
in 1.1.3 the 2 entries
C:\SikuliX\Lib
C:\SikuliX\sikulix.jar\Lib
are automatically added to the Jython sys.path by SikuliX

... and it has nothing to do with any PATH settings whatever.
It is simply taken from the place the sikulix.jar was loaded from.

In 2.0.x this is no longer done, because of potential clashes on sys.path.

If you want to have your own stuff automagically on sys.path, the this are your options:
https://sikulix-2014.readthedocs.io/en/latest/scenarios.html#access-python-packages-from-sikulix-scripts-run-by-sikulix-gui-or-commandline

with approach 2 your own stuff can be everywhere.

Changed in sikuli:
status: In Progress → Won't Fix
importance: Medium → Undecided
milestone: 2.0.4 → 2.0.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.