← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #667197]: how can i check if value is integer or string? Err in conversion

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
this is not needed this way
vpmin = int("40000")
vpmax = int("349999")

use
vpmin = 40000
vpmax = 349999

this is ok:
        vpvalue = vpvalue.replace("X", "") # 1
        vpvalue = vpvalue.replace(".", "") # 2
        vpvalue = vpvalue.replace(",", "") # i know i could do it with regex or something ;)
        converted_vpvalue = int(vpvalue)

in the end converted_vpvalue contains a number (integer).

This is also ok:
if converted_vpvalue >= vpmin and converted_vpvalue <= vpmax:

... so I cannot see in your snippet any reason for
"cannot concatenate 'str' and 'int' objects"

so the problem must be somewhere else (the error should show a line
number)

If you have the error location the solution is:
targetString = someString + str(someNumber)

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