← Back to team overview

sikuli-driver team mailing list archive

[Bug 1657355] [NEW] [1.1.1] Jython: special situations - need to be documented or fixed if possible

 

Public bug reported:

********************** import of java stuff
I'm trying to use JNA (https://github.com/java-native-access/jna) so I can look through the window titles and find the one and then bring it to the front.

load('jna-4.3.0.jar')
load('jna-platform-4.3.0.jar')

from com.sun.jna.platform.win32 import *

[error] ImportError ( No module named jna )

--- workaround
In the REPL, i can do:
  from com.sun.jna.platform.win32 import *
but this does not work with the interpreter.

In the interpreter, I must do:
  from com.sun.jna.platform.win32 import Win32
and import each one separately

Maybe something to do with Java package scanning as detailed here:
http://www.jython.org/jythonbook/en/1.0/ModulesPackages.html#java-package-scanning

** Affects: sikuli
     Importance: Low
     Assignee: RaiMan (raimund-hocke)
         Status: In Progress

** Changed in: sikuli
       Status: New => In Progress

** Changed in: sikuli
   Importance: Undecided => Low

** Changed in: sikuli
     Assignee: (unassigned) => RaiMan (raimund-hocke)

** Changed in: sikuli
    Milestone: None => 1.1.1

** Description changed:

- Hi,
- 
- What is the best way to use 3rd party Java libraries with the SikuliX
- IDE?
- 
- Since this is Jython, I tried using load(...), which does add the jar to
- the sys.path variable, but the import statement fails.
- 
- I'm trying to use JNA (https://github.com/java-native-access/jna) so I
- can look through the window titles and find the one and then bring it to
- the front.
+ ********************** import of java stuff
+ I'm trying to use JNA (https://github.com/java-native-access/jna) so I can look through the window titles and find the one and then bring it to the front.
  
  load('jna-4.3.0.jar')
  load('jna-platform-4.3.0.jar')
  
  from com.sun.jna.platform.win32 import *
  
  [error] ImportError ( No module named jna )
  
- Thanks
+ --- workaround
+ In the REPL, i can do:
+   from com.sun.jna.platform.win32 import *
+ but this does not work with the interpreter.
+ 
+ In the interpreter, I must do:
+   from com.sun.jna.platform.win32 import Win32
+ and import each one separately
+ 
+ Maybe something to do with Java package scanning as detailed here:
+ http://www.jython.org/jythonbook/en/1.0/ModulesPackages.html#java-package-scanning

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

Title:
  [1.1.1] Jython: special situations - need to be documented or fixed if
  possible

Status in Sikuli:
  In Progress

Bug description:
  ********************** import of java stuff
  I'm trying to use JNA (https://github.com/java-native-access/jna) so I can look through the window titles and find the one and then bring it to the front.

  load('jna-4.3.0.jar')
  load('jna-platform-4.3.0.jar')

  from com.sun.jna.platform.win32 import *

  [error] ImportError ( No module named jna )

  --- workaround
  In the REPL, i can do:
    from com.sun.jna.platform.win32 import *
  but this does not work with the interpreter.

  In the interpreter, I must do:
    from com.sun.jna.platform.win32 import Win32
  and import each one separately

  Maybe something to do with Java package scanning as detailed here:
  http://www.jython.org/jythonbook/en/1.0/ModulesPackages.html#java-package-scanning

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