sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #37107
[Bug 844546] Re: X-1.0rc3: from package import * does not work for Java classes in imported Sikuli scripts --- fixed in 1.1.0
** Summary changed:
- X-1.0rc3: from package import * does not work for Java classes in imported Sikuli scripts
+ X-1.0rc3: from package import * does not work for Java classes in imported Sikuli scripts --- fixed in 1.1.0
** Changed in: sikuli
Status: In Progress => Fix Committed
** Changed in: sikuli
Importance: High => Critical
** Description changed:
see https://answers.launchpad.net/sikuli/+question/170365
for details.
+ ***** proof of being fixed:
+ ---*** folder before run
+ Raimunds-MBP:~ raimundhocke$ ls -l /Users/raimundhocke/Desktop/SikuliX/TestImport
+ total 0
+ drwxr-xr-x 3 raimundhocke staff 102 6 Mär 16:51 main.sikuli
+ drwxr-xr-x 4 raimundhocke staff 136 6 Mär 16:58 sub.sikuli
- ***** workaround
+ ---*** content of main
+ Raimunds-MBP:~ raimundhocke$ cat /Users/raimundhocke/Desktop/SikuliX/TestImport/main.sikuli/main.py
+ from sub import *
+ action()
- when importing other .sikuli, use Java's fully qualified package names
- in the imported modules.
+ ---*** content of sub
+ Raimunds-MBP:~ raimundhocke$ cat /Users/raimundhocke/Desktop/SikuliX/TestImport/sub.sikuli/sub.py
+ #from sikuli import * # only needed if SikuliX features used in sub
+ from java.awt import Robot
+ from java.awt import Toolkit
+ from java.awt import Rectangle
+ from java.io import File
+ from javax.imageio import ImageIO
+ def action():
+ p = "/Users/raimundhocke/Desktop/SikuliX/TestImport" # getParentPath()
+ f = "test.jpg"
+ robot = Robot()
+ theImage = robot.createScreenCapture( \
+ Rectangle(Toolkit.getDefaultToolkit().getScreenSize()))
+ ImageIO.write(theImage, "jpg", File(p, f))
- see comment #2 in question
+ --- run the main script
+ Raimunds-MBP:~ raimundhocke$ /Applications/SikuliX.app/run -r /Users/raimundhocke/Desktop/SikuliX/TestImport/main.sikuli
+ running SikuliX: /Applications/SikuliX.app/Contents/Java/sikulix.jar -r /Users/raimundhocke/Desktop/SikuliX/TestImport/main.sikuli
- If you decide to use the direct import of the contained .py files, you
- have to import each class package like:
-
- from some.java.package import Class
-
- so you can use later
- x = Class()
-
- see comment #4 in question
-
- ----------------------------------------------------------------
+ ---*** folder after run: capture in file test.jpg
+ Raimunds-MBP:~ raimundhocke$ ls -l /Users/raimundhocke/Desktop/SikuliX/TestImport
+ total 344
+ drwxr-xr-x 3 raimundhocke staff 102 6 Mär 16:51 main.sikuli
+ drwxr-xr-x 4 raimundhocke staff 136 6 Mär 16:58 sub.sikuli
+ -rw-r--r-- 1 raimundhocke staff 174848 6 Mär 17:10 test.jpg
+ Raimunds-MBP:~ raimundhocke$
--
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/844546
Title:
X-1.0rc3: from package import * does not work for Java classes in
imported Sikuli scripts --- fixed in 1.1.0
Status in Sikuli:
Fix Committed
Bug description:
see https://answers.launchpad.net/sikuli/+question/170365
for details.
***** proof of being fixed:
---*** folder before run
Raimunds-MBP:~ raimundhocke$ ls -l /Users/raimundhocke/Desktop/SikuliX/TestImport
total 0
drwxr-xr-x 3 raimundhocke staff 102 6 Mär 16:51 main.sikuli
drwxr-xr-x 4 raimundhocke staff 136 6 Mär 16:58 sub.sikuli
---*** content of main
Raimunds-MBP:~ raimundhocke$ cat /Users/raimundhocke/Desktop/SikuliX/TestImport/main.sikuli/main.py
from sub import *
action()
---*** content of sub
Raimunds-MBP:~ raimundhocke$ cat /Users/raimundhocke/Desktop/SikuliX/TestImport/sub.sikuli/sub.py
#from sikuli import * # only needed if SikuliX features used in sub
from java.awt import Robot
from java.awt import Toolkit
from java.awt import Rectangle
from java.io import File
from javax.imageio import ImageIO
def action():
p = "/Users/raimundhocke/Desktop/SikuliX/TestImport" # getParentPath()
f = "test.jpg"
robot = Robot()
theImage = robot.createScreenCapture( \
Rectangle(Toolkit.getDefaultToolkit().getScreenSize()))
ImageIO.write(theImage, "jpg", File(p, f))
--- run the main script
Raimunds-MBP:~ raimundhocke$ /Applications/SikuliX.app/run -r /Users/raimundhocke/Desktop/SikuliX/TestImport/main.sikuli
running SikuliX: /Applications/SikuliX.app/Contents/Java/sikulix.jar -r /Users/raimundhocke/Desktop/SikuliX/TestImport/main.sikuli
---*** folder after run: capture in file test.jpg
Raimunds-MBP:~ raimundhocke$ ls -l /Users/raimundhocke/Desktop/SikuliX/TestImport
total 344
drwxr-xr-x 3 raimundhocke staff 102 6 Mär 16:51 main.sikuli
drwxr-xr-x 4 raimundhocke staff 136 6 Mär 16:58 sub.sikuli
-rw-r--r-- 1 raimundhocke staff 174848 6 Mär 17:10 test.jpg
Raimunds-MBP:~ raimundhocke$
To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/844546/+subscriptions
References