Error: range () integer and argument expected, got float

I can’t understand how to debug this error. See below.

– Dale

Hi,
Use rs.GetInteger() instead as you are presumably looking for an integer number of points. Alternatively you can turn your float into an integer with the int() function.
The error message is telling you that you are providing a float to the range function but it wants an integer.
-G

Thank you!

Thanks for the explanation!

The problem is mainly because of the float value in range function. Python range function does not accept floating point numbers as arguments, so you must use integers.

Range(start value, end value, step)

If it’s old code, it would have worked on Python 2. Integer division in Python 2 produces another integer. In Python 3 it produces a float.