I have managed to get my previous update cursor to work without any hiccups. All I have done is change the fields the script needs to look for. The error I am getting is:

RuntimeError: A column was specified that does not exist.

enter image description here

The column exists in the attribute table the runtime error is on line 52 of the script (for row in cursor) : Here is the script

#Script to add in a new period field and base the values on the existing HER period column
import arcpy

#Adjust these two lines:
fc = arcpy.GetParameterAsText(0)
fields = ['PeriodRang','PeriodFrom']

#Dictionary of old and new value. Add all your values here, instead of many if/elifs
remap = {
    'Later Prehistoric':'Prehistoric',
    'Late Mesolithic to Late Bronze Age':'Mesolithic',

with arcpy.da.UpdateCursor(fc, fields) as cursor:
    for row in cursor:
        if row[0] in remap: #row[0] is the value of periodRang field. This if, is checking whether the value exist in the remap dictionary
            row[1] = remap[row[0]]
            cursor.updateRow(row) ``` 

  • 1
    Add arcpy.Exists(fc) and arcpy.ListFields(fc) (with case-insensitive comparison with fields) validation to your script.
    – Vince
    Oct 18, 2021 at 12:12

1 Answer 1


I fixed the error by ticking the store relative path names in the properties.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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