← Back to team overview

sikuli-driver team mailing list archive

[Question #703421]: Fail to use Screen.wait() function within jpype

 

New question #703421 on SikuliX:
https://answers.launchpad.net/sikuli/+question/703421

Hi, I'm trying to implement some test code with jpype(Python) and sikulixapi-2.0.5.jar, and get the problem below:

# content of my_test.py

from jpype import *

JVM_PATH = r"C:\Program Files\Eclipse Adoptium\jdk-8.0.345.1-hotspot\jre\bin\server\jvm.dll"
SIKULIX_JAR_PATH = r"D:\my_jars\sikulixapi-2.0.5.jar"
BarPNG = "D:\\my_images\\nexusBar.png"

LongTimeout = float(60)

if __name__ == "__main__":
    try:
        startJVM(JVM_PATH, "-ea", "-Djava.class.path={}".format(SIKULIX_JAR_PATH))
        java.lang.System.out.println("hello World")

        Screen = JClass("org.sikuli.script.Screen")
        print(Screen)
        screenHandler = Screen()
        screenHandler.wait(BarPNG, LongTimeout)

it will throw exception when it runs into "screenHandler.wait(BarPNG, LongTimeout)", Python or JVM consider the wait() function is the one from  java.lang.Object.wait, not the one from org.sikulix.script.Region

(venv39) PS D:\dev\jpype_sikulix>
(venv39) PS D:\dev\jpype_sikulix>
[error] Mouse: not useable (blocked)
No matching overloads found for java.lang.Object.wait(str,float), options are:
        public final void java.lang.Object.wait() throws java.lang.InterruptedException
        public final native void java.lang.Object.wait(long) throws java.lang.InterruptedException
        public final void java.lang.Object.wait(long,int) throws java.lang.InterruptedException

Could someone help and know why? Thanks!


-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.