After upgrading to ArcGIS Pro 2.9.0 , my unit tests running arcpy.management.CalculateGeometryAttributes
have been failing with the error below.
The code works inside the ArcGIS Pro application without issue, but fails when run from the command line.
Traceback (most recent call last):
File "C:\Users\Jenkins_SA\Documents\Jenkins_Home\Hal\LRG_HAL_Tools\mapper\Edit_Layer.py", line 301, in calculate_area_for_selection
"SAME_AS_INPUT")
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 4153, in CalculateGeometryAttributes
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 4150, in CalculateGeometryAttributes
retval = convertArcObjectToPythonObject(gp.CalculateGeometryAttributes_management(*gp_fixargs((in_features, geometry_property, length_unit, area_unit, coordinate_system, coordinate_format), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: Traceback (most recent call last):
File "c:\program files\arcgis\pro\Resources\ArcToolbox\scripts\calculategeometry.py", line 276, in <module>
CalculateGeometry(fc, properties, lUnit, aUnit, cs, cformat)
File "c:\program files\arcgis\pro\Resources\ArcToolbox\scripts\calculategeometry.py", line 125, in CalculateGeometry
ucur.updateRow(row)
RuntimeError: An edit operation is required.
Command That Leads To Error:
The call:
arcpy.management.CalculateGeometryAttributes(self.the_layer, "acres AREA", '', "ACRES",
'PROJCS["NAD_1983_StatePlane_New_Mexico_Central_FIPS_3002_Feet",'
'GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",'
'SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM['
'"Greenwich",0.0],UNIT["Degree",0.0174532925199433]],'
'PROJECTION["Transverse_Mercator"],PARAMETER['
'"False_Easting",1640416.666666667],PARAMETER['
'"False_Northing",0.0],PARAMETER["Central_Meridian",'
'-106.25],PARAMETER["Scale_Factor",0.9999],PARAMETER['
'"Latitude_Of_Origin",31.0],UNIT["Foot_US",'
'0.3048006096012192]]',
"SAME_AS_INPUT")