I am trying to iterate through the attribute table to find duplicates of a field which is supposed to be a unique identifier. I figured I would use a tool to take in a parameter(feature class) as an argument for a search cursor, then append the result to a list. I was hoping to use that list to find duplicate values.
I have ran into a weird instance where the feature class I use as a parameter is deleted upon clicking the 'Run' button. Of course I then get an error:
File "Y:\Zack\Duplicate_stand_finder.atbx#DuplicateID_Duplicateidfinder.py", line 20, in <module> RuntimeError: cannot open 'Y:\Zack\Default.gdb\Rand_points'
Here is the code that I tried for testing purposes.
ids=  feature_class = arcpy.GetParameterAsText(0) field = arcpy.GetParameterAsText(1) with arcpy.da.SearchCursor(feature_class, field) as cursor: for i in cursor: ids.append(i) arcpy.AddMessage(ids)
Solved! Go to Solution.