← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #692550]: IDE crash when OCR does not find anything. Only 272 unsuccessful calls of text() possible

 

Question #692550 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/692550

    Status: Open => Answered

RaiMan proposed the following answer:
a better version of your snippet:

def text_shrink(Reg): # continously decrease region until OCR gets a match
        texts=""
        Reg=Reg.grow(30,30,0,0)
        while texts == "" and Reg.getW()>61:
            Reg=Reg.grow(-30,-30,0,0)
            texts=ExtractAlphanumeric_all(Reg.text()).strip() #crash here on OCR
        return texts

--- I cannot see any information about a "crash" (besides that the
script does not come back)

--- your function ExtractAlphanumeric_all() might have problems (endless
loop?)

--- generally it does not make sense to shrink a region, that does not
have text, to eventually find text in the shrinked region.

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