I'm using Python3 to update some fields in a populated feature class with new names using AlterFields (multiple). This is an example of my code:
alterFieldsDescription = [
['FIELD_1', 'newName_1'],
['FIELD_2', 'newName_2'],
['FIELD_3', 'newName_3']
]
arcpy.management.AlterFields(featureClass, alterFieldsDescription)
I am getting this error code:
ERROR 001658: Cannot alter field types on populated tables.
As far as I can tell, I am not altering the field types, only the field names with my code. My formatting is consistent with the example on the ESRI tool reference website except I am not including the '#' sign in the non-applicable optional parameters. Do I absolutely need to include the '#' signs so the tool knows I am only wanting to change the Field Name? Or am I missing some other obvious thing? I'm altering a lot of field names, so even copying/pasting the '#' signs for each field will be tedious
Example with '#' signs:
featureClass = 'pathToFeatureClass'
alterFieldsDescription = [
['FIELD_1', 'newName_1', '#', '#', '#', '#'],
['FIELD_2', 'newName_2', '#', '#', '#', '#'],
['FIELD_3', 'newName_3', '#', '#', '#', '#']
]
arcpy.management.AlterFields(featureClass, alterFieldsDescription)
I've checked that the path to my feature class is correct, my variable names are correct, all listed fields exist, and all field names are correctly capitalized.
I'm using arcpy.management.AlterField(featureClass, 'FieldName', 'newFieldName') earlier in the script for a different populated feature class, and that works exactly as intended. Is there something different with using AlterFields (multiple)?
I'd like to avoid adding new fields, updating the values of the new fields from the old fields, and deleting the old fields. I'd also like to avoid altering each field individually.
Thank you