Hey guys. I am creating a python toolbox that assigns selected polygons in a shapefile a unique id. This id features a section of string followed by a sequential ID. However, whenever I insert the following code block for autoIncrement into my script, the tool will no longer launch. This is the autoincrement block I have taken from ArcGIS Resources:
rec = 0
def autoIncrement():
global rec
pStart = 1 #adjust start value, if req'd
pInterval = 1 #adjust interval value, if req'd
if (rec == 0):
rec = pStart
else:
rec = rec + pInterval
return rec
I am placing it in the " def execute(self, parameters, messages):" section of the python toolbox template.
Any ideas as to why this is causing my script to fail? Thank you!