0

I am using a Python library called arcpy_metadata that uses 2 datatype called max_scale and min_scale that take integers: enter image description here

My code for that is just:

import arcpy, arcpy_metadata as md
....
min_scale = arcpy.GetParameterAsText(5)
max_scale = arcpy.GetParameterAsText(6)
....
metadata = md.MetadataEditor(file)
...
metadata. min_scale = min_scale
metadata.max_scale = max_scale

I am trying to turn this into a Python script in ArcMap toolbox. An example input for the max and min scale would 5000 and 150000000. Since there is no integer type and I don't really need decimals, I just entered double when configuring the parameters for the tool. I also set it as ``optional`. enter image description here

When I run the tool however, I keep getting the following error. What am I doing wrong here?

RuntimeWarning: Input value must be of type Integer
2

your inputs are strings, GetParameterasText is a string value.

convert that variable to an integer...

min_scale_int = int(min_scale)
max_scale_int = int(max_scale)

use your new variable in the rest of your code.

  • Arghhh! That totally worked! Can't believe I missed that. I guess I just assumed that if I entered an integer it would know it was an integer. – gwydion93 Sep 5 '18 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.