[1.0.1] global name 'getRegionFromPSRM' is not defined

Asked by Carma Needham

I just installed sikuli 1.0.1, and have several scripts that reliably ran on previous versions. I am getting this error:

[error] NameError ( global name 'getRegionFromPSRM' is not defined )

I have seen workaround for other similar errors (i.e. FindFailed). Is there a solution for this error?

Many thanks!

Question information

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

Why and how are you using this?

Has never been an official API.
When I revised the Region class, I made it private and renamed it to getRegionFromTarget().

So if you can tell me, what it is worth for, I will bring it back shortly.

Revision history for this message
Carma Needham (cmviola) said :
#2

here are the steps of my program:

findAll(imageA),
matchesList = []
matches = SCREEN.getLastMatches()
while matches.hasNext():
    matchesList.append(matches.next())
for x in matchesList:
     newRegion = getRegionFromPSRM(x).above(70)
     if newRegion.inside().exists(imageB):
          dragDrop across some text that is to the left of imageB
          do some other stuff

There are several instances of imageB on the SCREEN, so I had been getting the region of the match of imageA I was iterating on to make sure that the right imageB was begin paired with the right imageA. I'm sure there's a better way to do this, but I'm mostly self-taught, and this was the best way I could come up with!

Also, I tried newTarget = x.getTarget(), then getRegionFromTarget(newTarget), but getRegionFromTarget() also throws "[error] NameError ( global name 'getRegionFromTarget' is not defined )"

Any suggestions on how better to tackle this problem?

Thank you!

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

for x in list(e for e in findAll(imageA) if e.getScore() > 0.95):
    newRegion = x.above(70)
    if newRegion.exists(imageB):
        # her comes your other stuff

no need to use getRegionFromPSRM()

Can you help with this problem?

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

To post a message you must log in.