I am trying to change a field name in featureclasses (shapefiles) using AlterField_management, however I receive the following error message:
Runtime error Traceback (most recent call last): File "",
line 14, in File "c:\program files
(x86)\arcgis\desktop10.3\arcpy\arcpy\management.py", line 3332, in
AlterField raise e ExecuteError: ERROR 000664: Invalid input: The
type of dataset is not supported.
The code:
import arcpy
from os import path
arcpy.env.overwriteOutput = True
arcpy.env.workspace = r'C:\johnny\trial'
for fc in arcpy.ListFeatureClasses():
fieldList = arcpy.ListFields(fc)
for field in fieldList:
#if field.baseName != "NEAR_DIST":
arcpy.AlterField_management(fc, 'NEAR_DIST', 'distance', "distance", "DOUBLE")
Best Answer
In the Help for arcpy.AlterField_management() it says with my bolding:
From your code the workspace that you have set, which is a folder, rather than a geodatabase, makes me think that you are trying to use this on shapefiles instead of feature classes.