<?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: Error 99999: Failed to execute (Addfield) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/error-99999-failed-to-execute-addfield/m-p/211907#M16340</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;any of the entries begin with a number or did the first 8 characters have a space or some other non-underscore character?&lt;/P&gt;&lt;P&gt;The line where the error message failed would have been useful.&lt;/P&gt;&lt;P&gt;Also, you have ruled out there being more than 255 fields&lt;/P&gt;&lt;P&gt;While you are at it, you might want to review&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/appendices/geoprocessing-considerations-for-shapefile-output.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/appendices/geoprocessing-considerations-for-shapefile-output.htm"&gt;Geoprocessing considerations for shapefile output—Appendices | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I would suggest moving the testing to a featureclass in a file geodatabase&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 25 Feb 2020 22:38:07 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2020-02-25T22:38:07Z</dc:date>
    <item>
      <title>Error 99999: Failed to execute (Addfield)</title>
      <link>https://community.esri.com/t5/python-questions/error-99999-failed-to-execute-addfield/m-p/211904#M16337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to add multiple fields to an attribute table using the same attribute's tables current field names. I want the new fields to be text fields that can be populated with either yes or no later on. When I run the script below I get the error above. The script works halfway through and crashes. Any help or suggestions are welcome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;BR /&gt;from arcpy import env&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# To allow overwriting the outputs change the overwrite option to true.&lt;BR /&gt;arcpy.env.overwriteOutput = True&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# ###############################################################################&lt;BR /&gt;# [1] Script adds duplicate (text) fields to attribute table with shortened name&lt;BR /&gt;# Allows for Yes and No values to be added to table &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Identify shapefile&lt;BR /&gt;blocks = r"C:\Users\Workspace\scrap\FB_CFDReport.shp"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Generate list for each field in blocks &lt;BR /&gt;fields = arcpy.ListFields(blocks)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# For loop creates duplicate text fields in block shapefile &lt;BR /&gt;for field in fields:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; field4 = field.name&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; f4 = field4[0:8] + "X"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(f4)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(blocks, f4, "TEXT")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.SelectLayerByAttribute_management(blocks, selection_type="NEW_SELECTION", where_clause= field+ " &amp;gt; 0", invert_where_clause="")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.CalculateField_management(blocks, f4, 'Yes')&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.SelectLayerByAttribute_management(blocks, selection_type="NEW_SELECTION", where_clause= field+" = 0", invert_where_clause="")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #arcpy.CalculateField_management(blocks, f4, 'No')&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2020 20:41:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-99999-failed-to-execute-addfield/m-p/211904#M16337</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-02-25T20:41:21Z</dc:date>
    </item>
    <item>
      <title>Re: Error 99999: Failed to execute (Addfield)</title>
      <link>https://community.esri.com/t5/python-questions/error-99999-failed-to-execute-addfield/m-p/211905#M16338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/blogs/dan_patterson/2016/08/14/script-formatting"&gt;/blogs/dan_patterson/2016/08/14/script-formatting&lt;/A&gt;&amp;nbsp; would help with line numbers&lt;/P&gt;&lt;P&gt;You might want to check the field names to make sure.&amp;nbsp; Maybe show the results of your print statements.&lt;/P&gt;&lt;P&gt;Was there an error? or didn't it work, it isn't clear from the output&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2020 20:48:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-99999-failed-to-execute-addfield/m-p/211905#M16338</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-02-25T20:48:13Z</dc:date>
    </item>
    <item>
      <title>Re: Error 99999: Failed to execute (Addfield)</title>
      <link>https://community.esri.com/t5/python-questions/error-99999-failed-to-execute-addfield/m-p/211906#M16339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the response and see below for the part of the print statement and&amp;nbsp; error message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have changed most of the field names multiple times because I thought it might be something related to that. I'm going to try change the field names to a coded system to see if that works..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="color: #000000;"&gt;&amp;gt;&amp;gt;&amp;gt; FIDX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;ShapeX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;BLOCK10_X&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;CDFWX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;Row_LabeX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;anchovy_X&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;BarracudX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;bs_giantX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;bs_kelpX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;blacksmiX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;bonnito_X&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;pompano_X&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;cabezonX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;cod_pacX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;croak_unX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;croak_whX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;croak_yeX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;dolphin_X&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;Ca_morraX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;eel_wolfX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;escolarX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;flnd_arrX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;flnd_staX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;flyigfisX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;gby_yfinX&lt;/SPAN&gt;...(I deleted approx 50 entries)&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;...blue_shaX&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt;&amp;nbsp; File "C:\Python27\ArcGIS10.6\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exec codeObject in __main__.__dict__&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt;&amp;nbsp; File "C:\Users\Documents\GIS_Projects\Scripts\AddFieldIterator.py", line 25, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(blocks, f4, "TEXT")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt;&amp;nbsp; File "C:\Program Files (x86)\ArcGIS\Desktop10.6\ArcPy\arcpy\management.py", line 3435, in AddField&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; raise e&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff0000;"&gt;ExecuteError: ERROR 999999: Error executing function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #008080;"&gt;Failed to execute (AddField)&lt;/SPAN&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2020 22:03:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-99999-failed-to-execute-addfield/m-p/211906#M16339</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-02-25T22:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: Error 99999: Failed to execute (Addfield)</title>
      <link>https://community.esri.com/t5/python-questions/error-99999-failed-to-execute-addfield/m-p/211907#M16340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;any of the entries begin with a number or did the first 8 characters have a space or some other non-underscore character?&lt;/P&gt;&lt;P&gt;The line where the error message failed would have been useful.&lt;/P&gt;&lt;P&gt;Also, you have ruled out there being more than 255 fields&lt;/P&gt;&lt;P&gt;While you are at it, you might want to review&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/tool-reference/appendices/geoprocessing-considerations-for-shapefile-output.htm" title="https://pro.arcgis.com/en/pro-app/tool-reference/appendices/geoprocessing-considerations-for-shapefile-output.htm"&gt;Geoprocessing considerations for shapefile output—Appendices | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And I would suggest moving the testing to a featureclass in a file geodatabase&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2020 22:38:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-99999-failed-to-execute-addfield/m-p/211907#M16340</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-02-25T22:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: Error 99999: Failed to execute (Addfield)</title>
      <link>https://community.esri.com/t5/python-questions/error-99999-failed-to-execute-addfield/m-p/211908#M16341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh man, I can't believe I forgot about the 255 field limit. That has cleared up my issues with the code. Thanks Dan, I really appreciated your help with this issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2020 22:51:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-99999-failed-to-execute-addfield/m-p/211908#M16341</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-02-25T22:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: Error 99999: Failed to execute (Addfield)</title>
      <link>https://community.esri.com/t5/python-questions/error-99999-failed-to-execute-addfield/m-p/211909#M16342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is always something &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/wink.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2020 22:52:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-99999-failed-to-execute-addfield/m-p/211909#M16342</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2020-02-25T22:52:57Z</dc:date>
    </item>
  </channel>
</rss>

