calculate_area_for_selection on unit tests after 2.9.0 upgrade

11-29-2021 09:00 AM
New Contributor II

After upgrading to ArcGIS Pro 2.9.0 , my unit tests running

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\", line 301, in calculate_area_for_selection


File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\", line 4153, in CalculateGeometryAttributes

raise e

File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\", 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\", 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\", line 276, in <module>

CalculateGeometry(fc, properties, lUnit, aUnit, cs, cformat)

File "c:\program files\arcgis\pro\Resources\ArcToolbox\scripts\", line 125, in CalculateGeometry


RuntimeError: An edit operation is required.



Command That Leads To Error:

The call:, "acres AREA", '', "ACRES",



0 Kudos
2 Replies
New Contributor II

Thank you for the response.  Unfortunately, I cannot add a column to the layer.  It would be nice if Add Geometry Attributes had a parameter for the column.

I looked into CalculateField_management with an Arcade expression, which works, but the spatial reference seems to be limited to a wkid , which returns different results than the more specific spacial reference I am using in the original command.

The issue is new, as it did not occur prior to 2.9.0 . I will submit a ticket.


0 Kudos