In ArcGIS Pro 2.8.3 when trying to update a feature using Python update cursor an error occurs (see below). This error occurs in our enterprise implementation of the Water Utility Network Solution and also when using the sample Naperville data provided in a file geodatabase. Editing workflows in the ArcGIS Pro UI work fine for this type of edit. These attribute rules were provided as part of the Water Utility Network Solution. If I disable the attribute rule it will fail on another rule (Water Line - MeasuredLength From Shape), when both are disabled the edit occurs without error. Here is a simplified snippet of code:
import arcpy
aprx = arcpy.mp.ArcGISProject("CURRENT")
m = aprx.listMaps()[0]
idFeature = []
for lyr in m.listLayers():
lyrdesc = arcpy.Describe(lyr)
if lyr.isFeatureLayer:
fi = lyrdesc.fieldInfo
obj = lyrdesc.FIDSet
if obj:
wc = "OBJECTID in ({0})".format(obj.replace(";",","))
print(wc)
with arcpy.da.UpdateCursor(lyr, ["OID@", "NOTES"],wc) as cursor:
for row in cursor:
row[1] = "TEST"
cursor.updateRow(row)
RuntimeError: Failed to evaluate Arcade expression. [
Rule name: Water Line - Cathodic Protection Traceability,
Triggering event: Update,
Class name: WaterLine,
GlobalID: ,
Arcade error: Field not found cptraceability,
Script line: 25]