Pyjnius + Sikuli + MacOS: hangs when we try to create object of Screen class

71 Views Asked by At

On MacOS Monterey open the python3.9 in shell with pyjnius libary installed and sikuliapi 2.0.5 library jar added to CLASSPATH.

from jnius import autoclass  # works fine
Screen = autoclass('org.sikuli.script.Screen')  # works fine
screen = Screen()  # get stuck here with no error.

This works perfectly fine in windows.

1

There are 1 best solutions below

0
Raimund Hocke On

Ok, tried with 2.0.6-snapshot on a Mac M2.

  • Python 3.10 with pyjnius installed
  • CLASSPATH=..../sikulixide-2.0.6-SNAPSHOT-complete-macm.jar

In Python prompt:

  • Made Screen, Region and Image ready using autoclass()

This worked:

 print(Screen().toString())

gives: R[0,0 1470x956]@S(0)

image = Image(Screen().capture(0, 0, 40, 40))
match = Screen().find(image)
print(match.toString())

gives: M[0,0 40x40]IN(0) %100,00 C(20,20) [602/602 msec]

So the basic features are working.

Features that try to display a Java Frame or Dialog (Region.highlight, Screen.userCapture, SX.popup, ...) do not work and do not come back.

Conclusion: It principally works, but some features do not work.

I do not have a working Python 3 on Windows available, but I am sure, that the same would have happened on Windows.

RaiMan from SikuliX