I am trying to run a very simple script to test the usage of arcpy.SearchCursor and row.getValue.
I want to do a very simple exercise: I have a table with some fields, and I want to print the values of one of the fields (e.g. fldname) for every record.
The script is the below:
import arcpy
IN_Table = "C:/ZZtest/test.mdb/table"
Field1="fldname"
cursor=arcpy.SearchCursor(IN_Table)
for row in cursor:
printf=row.getValue(Field1)
print(printf)
del row, cursor
When I am running this I have the error below:
Traceback (most recent call last):
File "C:\ZZtest\ScriptName.py", line 28, in <module>
printf=str(row.getValue(Field1))
File "C:\Program Files (x86)\ArcGIS\Engine10.2\arcpy\arcpy\arcobjects\arcobjects.py", line 1048, in getValue
return convertArcObjectToPythonObject(self._arc_object.GetValue(*gp_fixargs(args)))
RuntimeError: ERROR 999999: Error executing function.
I tried to search for similar questions. But they all included more complicated scripts.
My ArcGIS version is 10.2.
The type of the "fldname" field is Integer.
Where is my mistake?
arcpy.da.SearchCursor
), which use a different row access protocol. Using personal geodatabase could also be mistake (they are not compatible with 64-bit arcpy). But the problem lies with the datatype of or data within the "fldname" column (which you will need to describe in the question text)