← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #259921]: Getting ValueError: invalid literal for __float__:

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
You are using Region.text(), which is known as not being very reliable.

So in your failing case, the read text in val might contain invalid
characters (that might not be visible in the printout).

You should wrap your float() in a try/except

try:
    valnew = float(val1) 
except:
    # do something to recover

recover:
e.g. collect only the numbers and the dot in a new string and the use float() again (which should work now)

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.