← Back to team overview

sikuli-driver team mailing list archive

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

 

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

Hi All,
I am trying to catch a value from tooltip and convert it to 'Float' for further calculation. For some value it works perfect but at some points it raise an error and script fails. Can any one help me and point me to link which might resolve the issue.

Following is the code:

for i in var1.findAll(imageIcon):
    count += 1
    print "i = ", i
    hover(i)
    #mm = var1.getLastMatches()
    #arr[]
    #hover(imageIcon)
    wait(tooltip, 2)
    #hover("image1.png")
    if exists(tooltip):
        print "Tooltip displayed"
        ttRegion = Region(find(tooltip))
        ttRegion.highlight(2)
        newttRegion = Region(ttRegion.find(revenue))
        newttRegion.highlight(2)
        new = Region(newttRegion.x+50, newttRegion.y+0, newttRegion.w+20, newttRegion.h+5)
        new.highlight(2)
        val = new.text()
        val1 = val.strip('$')
        print "val value: ", val1
        valnew = float(val1) ---------------------- Error is raised for this line.
        print "Revenue Value: ", valnew
        temp = temp+valnew
        print "Temp value: ", temp
        click("image1.png")
        
    else:
        print "Tooltip not displayed"

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