← Back to team overview

sikuli-driver team mailing list archive

[Bug 2008628] [NEW] getLastMatch() returns null/None after wait/find/exists

 

Public bug reported:

I wanted to reuse code from another sikuli script, so I've followed your
documentation about that:
https://sikulix-2014.readthedocs.io/en/latest/scripting.html#importing-
other-sikuli-scripts-reuse-code-and-images

And one of the prerequisites says that my imported script MUST include this for its first line:
from sikuli import *

However, when I import everything from Sikuli as requested, things
didn't work as before. I've isolated the code and basically:


from Sikuli import *

wait(<some_pattern>, FOREVER)
print 'Debugging point:', getLastMatch()
click(getLastMatch())


That doesn't click anything, however, it finds the pattern but prints "Debugging point: None"

But the following two solutions work:

1. Work with the returned Match:


from Sikuli import *

click(wait(<some_pattern>, FOREVER))


2.  Remove the importing line


wait(<some_pattern>, FOREVER)
click(getLastMatch())


Maybe more of a report than a question, but, is this the intended
behavior? I was expecting the "getLastMatch()" to continue working as
expected. Seems a little odd that stops working as before and no
documentation explaining it..

Thank you in advance for this awesome tool!


--- System Info:
OS: Windows 10
Not sure what else could be helpful here

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

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

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

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

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

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

Title:
  getLastMatch() returns null/None after wait/find/exists

Status in SikuliX:
  In Progress

Bug description:
  I wanted to reuse code from another sikuli script, so I've followed
  your documentation about that:
  https://sikulix-2014.readthedocs.io/en/latest/scripting.html#importing-
  other-sikuli-scripts-reuse-code-and-images

  And one of the prerequisites says that my imported script MUST include this for its first line:
  from sikuli import *

  However, when I import everything from Sikuli as requested, things
  didn't work as before. I've isolated the code and basically:

  
  from Sikuli import *

  wait(<some_pattern>, FOREVER)
  print 'Debugging point:', getLastMatch()
  click(getLastMatch())

  
  That doesn't click anything, however, it finds the pattern but prints "Debugging point: None"

  But the following two solutions work:

  1. Work with the returned Match:

  
  from Sikuli import *

  click(wait(<some_pattern>, FOREVER))

  
  2.  Remove the importing line

  
  wait(<some_pattern>, FOREVER)
  click(getLastMatch())


  Maybe more of a report than a question, but, is this the intended
  behavior? I was expecting the "getLastMatch()" to continue working as
  expected. Seems a little odd that stops working as before and no
  documentation explaining it..

  Thank you in advance for this awesome tool!

  
  --- System Info:
  OS: Windows 10
  Not sure what else could be helpful here

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



Follow ups