← Back to team overview

sikuli-driver team mailing list archive

[Bug 799067] Re: X-1.0rc3: Windows: import broken

 

The situations cannot be compared this way.

-- your Python example only works because of the implicit package
structure for a python main script

-- we are not talking about .py scripts in same folder, we are talking
about .sikuli folders, containing .py scripts in same folder

-- so staying on the py-script level your test case has to be:

--- Python case
somedirsub/
lib.py - library with functions 
somedirmain/
script.py - script that imports library

In Python:
cd somedirmain/
python script.py
# - import will fail

cd otherdir/
python /path/to/script.py
# - import will fail

--- In Sikuli: (Win7)
somedir/
lib.sikuli - library with functions 
script.sikuli - script that imports library

cd somedir/
path-to-sikuli-ide.exe -r script.sikuli
# does not work at all: script not found (current folder is program folder/Sikuli)

cd somedir/ or cd otherdir/
path-to-sikuli-ide.exe -r path-to-somedir/script.sikuli
# import fails (looks in current folder which is program folder/Sikuli)

cd somedir/ # is current folder 
path-to-sikuli-ide.bat -r script.sikuli
# import ok

cd otherdir/ # is current folder
path-to-sikuli-ide.bat -r /path/to/script.sikuli
# import fails

So it seems, that Sikuli currently looks for an imported .sikuli in the
current working directory, when run from commandline. This implicit
import location only works when using Sikuli-IDE.bat. This is not at all
a consistent and reliable behaviour regarding all the different
possibilities to run Sikuli scripts.

So finally:

- what you reclaim is neither a feature nor a bug since the implicit
import location is not related to the main script location, but it
relates to the runtime environment.

- you might post a request bug for this convenience feature:
Want, that imported scripts .sikuli are found in the main scripts directory automatically in any cases (no need to maintain sys.path)

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/799067

Title:
  X-1.0rc3: Windows: import broken

Status in Sikuli:
  New

Bug description:
  It may be too early to report, but the latest binary from
  http://sikuli.org/hudson/ can not find .sikuli files imported as:

      from imglib import *

  This works in X-1.0rc2

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/799067/+subscriptions


References