I am trying to copy attributes from a layer to a table but the Geometry fields are giving me problems. I need help ignoring the OID and Geometry fields and i though line 11 would do it.
The feature class fields
Shape.STArea() & Shape>STLength()
Table fields
Shape_STarea_ & Shape_STLength
I have the following but get error.
line 17, in <module>
iCur.insertRow(row)
RuntimeError: Cannot find field 'Shape.STArea()'
arcpy.env.workspace = r"C:Temp\Test.gdb"
database = r"C:Temp\Test.gdb"
fc1 = "TestLayer1
fc2 = "Table1"
dsc = arcpy.Describe(fc1)
fields = dsc.fields
# List all field names except the OID field and geometry fields
#
fieldnames = [fields.name for fields in fields if fields.name != dsc.OIDFieldName and fields.type != 'Geometry']
# Create cursors and insert new rows
with arcpy.da.SearchCursor(fc1,fieldnames) as sCur:
with arcpy.da.InsertCursor(fc2,fieldnames) as iCur:
for row in sCur:
iCur.insertRow(row)
del sCur