I am counting the number of features in a geodabase. I am triying to insert the feature name and the count inside a dbf table which has only two fields: "FEAT" (Text field which containts the feature name) and "COUNT" (short field which contains the feature count).
This is my code:
listlayers= arcpy.ListFeatureClasses()
for feat in listlayers:
count = 0
count = arcpy.GetCount_management(feat)
feat = str(feat)
if count > 0:
print feat + " has " + str(count) + " entries"
with arcpy.da.InsertCursor(destinationgeneraltable, ("FEAT","COUNT")) as icursor:
icursor.insertRow((feat,count))
else:
print feat + " is void"
I use an insert cursor to insert these records inside this table but it fails without any error message.