AnsweredAssumed Answered

ArcGIS Pro 2.5.0 - ArcPy issue - VERY DANGEROUS

Question asked by gis@explor.net on Apr 16, 2020
Latest reply on Apr 16, 2020 by gis@explor.net

To whom it may concern

 

A recent update for ArcGIS Pro 2.5.0 and ArcPY will cause serious issues to features and shapefiles.

 

While testing some code I wrote between myself and our GIS analyst, I found something very odd occurring with the following sample code snipet.

 

arcpy.management.CalculateField(currentFeature, "DesiredFieldName", "'New Text'", "PYTHON3", '')

 

In ArcGIS 2.4.2 this code snippet fails if "DesiredFieldName" does not exist in the table of currentFeature. This is normal and should occur ensuring that currentFeature is indeed properly formated and that "DesiredFieldName" is indeed within the feature.

 

However, in ArcGIS Pro 2.5.0 this code adds the field "DesiredFieldName" if it does not exist and fills it with "'New Text'"... this is very very VERY dangerous.

 

I would much rather code fail to require a coding change than have code "succeed" by damaging my features / shapefiles if I run the following snipet:

 

arcpy.management.CalculateField(currentFeature, "DesiredFieldName_SPELLED_WRONG", "'New Text'", "PYTHON3", '')

 

Note: I am assuming this is a ArcGIS Pro version issue as this was the only difference between myself and our GIS analyst.

 

Outcomes