EDIT: What I forgot to mention when I first had this question is that I was trying to do these calculations on a layer which had joins, BUT where the join was on data that was added from an Excel file. ArcGIS does not seem to like data from Excel files.
I am trying to use the arcpy.CalculateField_management function and running into some trouble.
I have a shapefile called district_plans, and to this shapefile I have joined a table of data (the table of data is named kdp). I want to change a field in district_plans to the data in one of the columns of kdp.
Trying the following
arcpy.CalculateField_management("district_plans","district_plans.drawplan", "!kdp$.plan_4!","PYTHON")
yields the following error message
Runtime error Traceback (most recent call last): File "<string>", line 1, in
<module> File "c:\program files x86)\arcgis\desktop10.2\arcpy\arcpy\management.py",
line 3183, in CalculateField raise e ExecuteError: Failed to execute. Parameters
are not valid. ERROR 000728: Field district_plans.drawplan does not exist within
table Failed to execute (CalculateField).
Trying the following
arcpy.CalculateField_management("district_plans","drawplan", "!kdp$.plan_4!","PYTHON")
yields the following error message
Runtime error Traceback (most recent call last): File "<string>", line 1, in
<module> File "c:\program files x86)\arcgis\desktop10.2\arcpy\arcpy\management.py",
line 3183, in CalculateField raise e ExecuteError: ERROR 999999: Error executing
function. Failed to execute (CalculateField).
The following variations all yield errors:
arcpy.CalculateField_management("district_plans","district_plans.drawplan", "!plan_4!","PYTHON")
arcpy.CalculateField_management("district_plans","drawplan", "!plan_4!","PYTHON")
I am able to manually perform the field calculation using the field calculator on the drawplan column in the attribute table of district_plans, so I am not sure why the Python version does not work.