[1.0] Observe: Eclipse/Jython: ClassCastException: org.python.core.PyMethod cannot be cast to org.sikuli.script.SikuliEventObserver

Asked by Bunnings

System Details
Windows XP, jre6, Sikuli 1.0 with Eclipse/Jython

I have an event observer which fires onAppear. Worked perfectly in RC3 version of Sikuli.

Received the following error using Sikuli 1.0

Traceback (most recent call last):
  File "__pyclasspath__/Scripts/Current.py", line 263, in OK
  File "__pyclasspath__/Scripts/Current.py", line 36, in PostTransactionEvent
ClassCastException: java.lang.ClassCastException: org.python.core.PyMethod cannot be cast to org.sikuli.script.SikuliEventObserver

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
RaiMan Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

could you pls. provide the relevant code snippet (onXXX, observe, handler)

Revision history for this message
Bunnings (sillybilly) said :
#2

Hi Raiman, apologies should have put the code while raising the issue.

The below method is called after a button is clicked. (Timeouts.Observe is 3 secs, Timeout.Wait is 10 secs)

def PostTransactionEvent(self):
    """ wait while posting transaction handler, make it run in the foreground """
    self.screen.onAppear("PostingTrans.png", self.WaitWhilePostingTransaction)
    self.screen.observe(Timeouts.Observe, background = False)

event handler
-------------------
def WaitWhilePostingTransaction(self, event):
    self.screen.waitVanish(event.match, Timeouts.Wait)
    event.region.stopObserver()

Revision history for this message
RaiMan (raimund-hocke) said :
#3

Thanks, but no need to apologize ;-)

Triggered by your report, I tested in the IDE and did not get a problem with the above basic usage of observe().
So it might have to do something with the special use of Sikuli in this Eclipse/Jython environment.
Something with the sequence of entries in java class path and or python path.
I will try to check this today.

But I found another ugly problem with observe(), that might have the effect, that observe() would not work as expected for you anyway: bug 1183671
I will first try to fix this problem.

Revision history for this message
RaiMan (raimund-hocke) said :
#4

sorry, on vacation until June 10th

Can you help with this problem?

Provide an answer of your own, or ask Bunnings for more information if necessary.

To post a message you must log in.