Hi,I'm probably overlooking something obvious, but i'm unable to set a value on a field of a feature class. Here is a short example to show what I am doing.
import arcpy
from arcpy import env
env.workspace = r"X:\temp"
fc = "temp.shp"
desc = arcpy.Describe( fc )
print 'Fields: '
for field in desc.fields:
print 'Name: ', field.name, 'Type: ', field.type, 'Length: ', repr(field.length)
rows = arcpy.SearchCursor( fc )
for row in rows:
row.setValue("S_T_R", "test")
Here is the output:
Fields:
Name: FID Type: OID Length: 4
Name: Shape Type: Geometry Length: 0
Name: TOWNSHIP_N Type: Double Length: 11
Name: TOWNSHIP_D Type: String Length: 1
Name: RANGE_NUM Type: Double Length: 11
Name: RANGE_DIR Type: String Length: 1
Name: RECORD_NUM Type: String Length: 3
Name: SECTION Type: Double Length: 11
Name: ID_FIELD Type: String Length: 9
Name: S_T_R Type: String Length: 12
Traceback (most recent call last):
File "C:/code/scripts/GIS/addS_T_R.py", line 20, in <module>
row.setValue("S_T_R", "test")
File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\arcobjects\arcobjects.py", line 940, in setValue
return convertArcObjectToPythonObject(self._arc_object.SetValue(*gp_fixargs(args)))
RuntimeError: ERROR 999999: Error executing function.
Thanks for any pointers.Dustin