Getting the following error on:
File "N:\Python\Completed scripts\Check_for_Dupes.py", line 13, in findDupesvalues = [r[0] for r in rows]RuntimeError: A column was specified that does not exist.
Here is the script producing the error:
# Finds duplicate values in a specified feature class field and populates those reords with a 'Y'import arcpy# enter program inputsinFeatureClass = raw_input("Enter feature class path from ArcCatalog: ")checkField = raw_input("Enter field name containing dupes: ")updateField = raw_input("Enter field name to indicate duplicates: ")def findDupes(inShapefile, checkField, updateField): with arcpy.da.SearchCursor(inFeatureClass, [checkField]) as rows: values = [r[0] for r in rows] with arcpy.da.UpdateCursor(inFeatureClass, [checkField, updateField]) as rows: for row in rows: if values.count(row[0]) > 1: row[1] = 'Y' else: row[1] = 'N' rows.updateRow(row)if __name__ == '__main__': fc = r'C:\TEMP\crm_test.gdb\test' fld = 'Project_Manager' up = 'duplicates' indDupes(fc, fld, up)I've tried hardcoding the input variables and got the same result. This script was slightly modified from a previous post:
Use Python to Find duplicate values in a feature Class and populate a field
أكثر...
File "N:\Python\Completed scripts\Check_for_Dupes.py", line 13, in findDupesvalues = [r[0] for r in rows]RuntimeError: A column was specified that does not exist.
Here is the script producing the error:
# Finds duplicate values in a specified feature class field and populates those reords with a 'Y'import arcpy# enter program inputsinFeatureClass = raw_input("Enter feature class path from ArcCatalog: ")checkField = raw_input("Enter field name containing dupes: ")updateField = raw_input("Enter field name to indicate duplicates: ")def findDupes(inShapefile, checkField, updateField): with arcpy.da.SearchCursor(inFeatureClass, [checkField]) as rows: values = [r[0] for r in rows] with arcpy.da.UpdateCursor(inFeatureClass, [checkField, updateField]) as rows: for row in rows: if values.count(row[0]) > 1: row[1] = 'Y' else: row[1] = 'N' rows.updateRow(row)if __name__ == '__main__': fc = r'C:\TEMP\crm_test.gdb\test' fld = 'Project_Manager' up = 'duplicates' indDupes(fc, fld, up)I've tried hardcoding the input variables and got the same result. This script was slightly modified from a previous post:
Use Python to Find duplicate values in a feature Class and populate a field
أكثر...