sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #28665
[Bug 1379844] Re: Functions cannot be cast as a handler in Eclipse integration
this
r = sikuli.Region.create(1 , 35,500,500)
has to be
r = Region(1 , 35,500,500)
... since using Region.create() is reserved for the usage on the Java
level (does not create a Jython Region, that understands observe()
correctly).
--
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1379844
Title:
Functions cannot be cast as a handler in Eclipse integration
Status in Sikuli:
New
Bug description:
I'm running some user acceptance tests before beginning a section of a
project, so the code is very generic. I'm attempting to create a
background listener before launching my automation code to look for
unexpected errors within UI regression suites.
I'm getting the following error:
Traceback (most recent call last):
File "C:\test\TPS_70\Script\GUI\MatchingExample.sikuli\MatchingExample.py", line 18, in <module>
r.onAppear(sikuli.Pattern("folder.png").similar(0.69), errorOut)
at org.sikuli.script.Region.onAppear(Region.java:2023)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.lang.reflect.Method.invoke(Unknown Source)
java.lang.ClassCastException: java.lang.ClassCastException: org.python.core.PyFunction cannot be cast to org.sikuli.script.SikuliEventObserver
This is coming from the following code:
import sikuli.Sikuli as sikuli
sikuli.Settings.OcrTextRead = True
sikuli.Settings.OcrTextSearch = True
import datetime
import time
def errorOut(event):
assert False, "WOO!"
r = sikuli.Region.create(1 , 35,500,500)
r.onAppear(sikuli.Pattern("thing.png").similar(0.69), errorOut)
print "before" + str(datetime.datetime.now().time().isoformat())
r.observe(25, background=True)
print "onward" + str(datetime.datetime.now().time().isoformat())
for x in xrange(15):
time.sleep(1)
print "This"
I've been waiting about 5-10 seconds and then opening the Google Chrome homepage which is what "thing.png" is of, and I want it to throw the exception when it shows up in the middle of the print statements. It is working as expected in the Sikuli IDE, but we are using Eclipse for our projects as they are very large.
I'm using Sikulix 1.0.1 but to use the IDE I have needed to replace
the files with an r930 build (Work around I found online for a bug
causing the IDE not to launch), this causes an error that
org.sikuli.basics cannot be found if I attempt to run the script in
Eclipse with this version being run. It's a 32-bit system.
To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1379844/+subscriptions
References