<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ArcGIS Pro 2.5.0 - ArcPy issue - VERY DANGEROUS in Python Snippets Questions</title>
    <link>https://community.esri.com/t5/python-snippets-questions/arcgis-pro-2-5-0-arcpy-issue-very-dangerous/m-p/798369#M231</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Joe!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for replying.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Drop the field and re-run", yes, write checking code, yes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can even see the value in '&lt;SPAN style="background-color: #ffffff; border: 0px;"&gt;"&lt;STRONG style="border: 0px; font-weight: bold;"&gt;CalculateField_or_AddFieldIfItDoesNotExist&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; border: 0px;"&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But here is the timeline of events for&amp;nbsp;my use of the geoprocessing tool that is called "&lt;STRONG&gt;CalculateField&lt;/STRONG&gt;"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have consistent fields through multiple features in multiple projects. One field is called "&lt;STRONG&gt;SRCSTATUS&lt;/STRONG&gt;", a text field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have more or less hardcoded it as it is consistently added to multiple features and used regularly to pass information from office to field and back.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I upgraded to ArcGIS Pro. 2.5.0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been writing code to go from CSV to GDB to Online.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To save time I created a dummy CSV that &lt;SPAN style="text-decoration: underline;"&gt;I forgot to put in&lt;/SPAN&gt; "&lt;STRONG&gt;SRCSTATUS&lt;/STRONG&gt;" as a field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because &lt;SPAN&gt;"&lt;/SPAN&gt;&lt;STRONG&gt;CalculateField&lt;/STRONG&gt;&lt;SPAN&gt;" in 2.5.0 is actually&amp;nbsp;&lt;SPAN style="background-color: #ffffff; border: 0px;"&gt;"&lt;STRONG style="border: 0px; font-weight: bold;"&gt;CalculateField_or_AddFieldIfItDoesNotExist&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; border: 0px;"&gt;", I experienced no issues. In fact,&lt;STRONG style="text-decoration: underline; "&gt; the update to the tool FIXED my data&lt;/STRONG&gt;.&amp;nbsp; This happened twice in my code for the field "&lt;STRONG&gt;SRCSTATUS&lt;/STRONG&gt;" and another field "&lt;STRONG&gt;MultiTag&lt;/STRONG&gt;" (a short field).&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; border: 0px; "&gt;However! I gave the code to my analyst to test, and it promptly failed at "&lt;STRONG&gt;CalculateField&lt;/STRONG&gt;" on the test data. She lacks experience as to what to do and would have been stuck for hours had I not been online at the time. It took me a head scratch and a check of ArcGIS Pro versions (mine 2.5.0 hers 2.4.1) to realize something had changed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I see a point where automated code will run and instead of errors stopping at mistakes (as it should), the mistakes keep going and going and going. I could perpetuate a misspelling or "mis-fielding" on ten's to hundreds to thousands of features.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Wait till I tell you what the update to "CaclulateField"&amp;nbsp;did to a JOIN with a wrong field once I can understand what the heck went wrong there.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 17 Apr 2020 01:52:02 GMT</pubDate>
    <dc:creator>ChrisHarrison7</dc:creator>
    <dc:date>2020-04-17T01:52:02Z</dc:date>
    <item>
      <title>ArcGIS Pro 2.5.0 - ArcPy issue - VERY DANGEROUS</title>
      <link>https://community.esri.com/t5/python-snippets-questions/arcgis-pro-2-5-0-arcpy-issue-very-dangerous/m-p/798365#M227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To whom it may concern&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A recent update for ArcGIS Pro 2.5.0 and ArcPY will cause serious issues to features and shapefiles.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While testing some code I wrote between myself and our GIS analyst, I found something very odd occurring with the following sample code snipet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;arcpy.management.CalculateField(currentFeature, "DesiredFieldName", "'New Text'", "PYTHON3", '')&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, in ArcGIS Pro 2.5.0 &lt;STRONG&gt;&lt;SPAN style="text-decoration: underline;"&gt;this code adds the field&lt;/SPAN&gt; "DesiredFieldName"&lt;/STRONG&gt; if it does not exist and fills it with&amp;nbsp;"'New Text'"... &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;this is very very VERY dangerous.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would much rather code fail to require&amp;nbsp;a coding change than have code "succeed" by damaging my features / shapefiles if I run the following snipet:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;arcpy.management.CalculateField(currentFeature, "DesiredFieldName_SPELLED_WRONG", "'New Text'", "PYTHON3", '')&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Note:&amp;nbsp;&lt;/STRONG&gt;I am assuming this is a ArcGIS Pro version issue as this was the only difference between myself and our GIS analyst.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2020 20:52:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/arcgis-pro-2-5-0-arcpy-issue-very-dangerous/m-p/798365#M227</guid>
      <dc:creator>ChrisHarrison7</dc:creator>
      <dc:date>2020-04-16T20:52:01Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro 2.5.0 - ArcPy issue - VERY DANGEROUS</title>
      <link>https://community.esri.com/t5/python-snippets-questions/arcgis-pro-2-5-0-arcpy-issue-very-dangerous/m-p/798366#M228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're right that this changed at 2.5.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Documented here:&amp;nbsp;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/data-management-toolbox-history-pro.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/data-management-toolbox-history-pro.htm"&gt;Data Management toolbox history—Data Management toolbox | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="488989" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/488989_pastedImage_2.png" /&gt;&lt;/P&gt;&lt;P&gt;The details are explained in the tool's help.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/calculate-field.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/data-management/calculate-field.htm"&gt;Calculate Field—Data Management toolbox | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-3 jive-image" src="https://community.esri.com/legacyfs/online/488991_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="488990" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/488990_pastedImage_4.png" /&gt;&lt;/P&gt;&lt;P&gt;I don't really work with Python much, but&amp;nbsp;knowing how the tool now works with the capability to add a new field if it doesn't exist and specify the field_type, would you be able to adjust the script to check for existing fields and have the calculate field line only accept an existing field?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2020 21:50:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/arcgis-pro-2-5-0-arcpy-issue-very-dangerous/m-p/798366#M228</guid>
      <dc:creator>KoryKramer</dc:creator>
      <dc:date>2020-04-16T21:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro 2.5.0 - ArcPy issue - VERY DANGEROUS</title>
      <link>https://community.esri.com/t5/python-snippets-questions/arcgis-pro-2-5-0-arcpy-issue-very-dangerous/m-p/798367#M229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Kory!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for replying!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I reprogram such that the code checks for the existence of the field prior to calculating?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes. I can go through my thousands of lines of code to fix. Tis the nature of coding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I may even come to love a geoprocessing tool that says one thing in its name, "&lt;STRONG style="background-color: #ffffff; border: 0px; font-weight: bold;"&gt;CalculateField"&amp;nbsp;&lt;/STRONG&gt;but&amp;nbsp;is actually "&lt;STRONG&gt;CalculateField_or_AddFieldIfItDoesNotExist&lt;/STRONG&gt;"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps ESRI is trying to phase out "&lt;STRONG&gt;AddField&lt;/STRONG&gt;"?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But as it stands, this is just plain dangerous.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In testing (or even processing) I could mistakenly point at feature B&amp;nbsp;instead of A, and add a series of fields to my feature without knowing it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At best,&amp;nbsp;ESRI is&amp;nbsp;forcing testers to go back and delete the fields. A typical day for us coders.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At worst, mistakes are compounding and going &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;unnoticed&lt;/STRONG&gt;&lt;/SPAN&gt; in a geodatabase based on "&lt;STRONG&gt;CalculateField&lt;/STRONG&gt;" actually being &lt;SPAN&gt;"&lt;STRONG&gt;CalculateField_or_AddFieldIfItDoesNotExist&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Apr 2020 22:47:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/arcgis-pro-2-5-0-arcpy-issue-very-dangerous/m-p/798367#M229</guid>
      <dc:creator>ChrisHarrison7</dc:creator>
      <dc:date>2020-04-16T22:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro 2.5.0 - ArcPy issue - VERY DANGEROUS</title>
      <link>https://community.esri.com/t5/python-snippets-questions/arcgis-pro-2-5-0-arcpy-issue-very-dangerous/m-p/798368#M230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't see it as dangerous, per se; the worst you end up with is a new, misspelled field, right?&amp;nbsp; Drop that field and re-run the calculation. If you goof up your spelling in a stand alone script and then continue to work on the correctly spelled field, thinking it's been updated, then yes, that's not good thing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps you could elaborate on what you stand to lose or corrupt; there may be a work around for you.&amp;nbsp; One thing I like to do for field names in a stand alone script is to first do this is in the console:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; field &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListFields&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;your_data&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;field&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then it's a copy and paste of the field name(s) you want to work with....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:14:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/arcgis-pro-2-5-0-arcpy-issue-very-dangerous/m-p/798368#M230</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2021-12-12T09:14:20Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro 2.5.0 - ArcPy issue - VERY DANGEROUS</title>
      <link>https://community.esri.com/t5/python-snippets-questions/arcgis-pro-2-5-0-arcpy-issue-very-dangerous/m-p/798369#M231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Joe!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for replying.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Drop the field and re-run", yes, write checking code, yes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can even see the value in '&lt;SPAN style="background-color: #ffffff; border: 0px;"&gt;"&lt;STRONG style="border: 0px; font-weight: bold;"&gt;CalculateField_or_AddFieldIfItDoesNotExist&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; border: 0px;"&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But here is the timeline of events for&amp;nbsp;my use of the geoprocessing tool that is called "&lt;STRONG&gt;CalculateField&lt;/STRONG&gt;"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have consistent fields through multiple features in multiple projects. One field is called "&lt;STRONG&gt;SRCSTATUS&lt;/STRONG&gt;", a text field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have more or less hardcoded it as it is consistently added to multiple features and used regularly to pass information from office to field and back.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I upgraded to ArcGIS Pro. 2.5.0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been writing code to go from CSV to GDB to Online.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To save time I created a dummy CSV that &lt;SPAN style="text-decoration: underline;"&gt;I forgot to put in&lt;/SPAN&gt; "&lt;STRONG&gt;SRCSTATUS&lt;/STRONG&gt;" as a field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Because &lt;SPAN&gt;"&lt;/SPAN&gt;&lt;STRONG&gt;CalculateField&lt;/STRONG&gt;&lt;SPAN&gt;" in 2.5.0 is actually&amp;nbsp;&lt;SPAN style="background-color: #ffffff; border: 0px;"&gt;"&lt;STRONG style="border: 0px; font-weight: bold;"&gt;CalculateField_or_AddFieldIfItDoesNotExist&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="background-color: #ffffff; border: 0px;"&gt;", I experienced no issues. In fact,&lt;STRONG style="text-decoration: underline; "&gt; the update to the tool FIXED my data&lt;/STRONG&gt;.&amp;nbsp; This happened twice in my code for the field "&lt;STRONG&gt;SRCSTATUS&lt;/STRONG&gt;" and another field "&lt;STRONG&gt;MultiTag&lt;/STRONG&gt;" (a short field).&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; border: 0px; "&gt;However! I gave the code to my analyst to test, and it promptly failed at "&lt;STRONG&gt;CalculateField&lt;/STRONG&gt;" on the test data. She lacks experience as to what to do and would have been stuck for hours had I not been online at the time. It took me a head scratch and a check of ArcGIS Pro versions (mine 2.5.0 hers 2.4.1) to realize something had changed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I see a point where automated code will run and instead of errors stopping at mistakes (as it should), the mistakes keep going and going and going. I could perpetuate a misspelling or "mis-fielding" on ten's to hundreds to thousands of features.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Wait till I tell you what the update to "CaclulateField"&amp;nbsp;did to a JOIN with a wrong field once I can understand what the heck went wrong there.&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Apr 2020 01:52:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/arcgis-pro-2-5-0-arcpy-issue-very-dangerous/m-p/798369#M231</guid>
      <dc:creator>ChrisHarrison7</dc:creator>
      <dc:date>2020-04-17T01:52:02Z</dc:date>
    </item>
  </channel>
</rss>

