<?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 Not all feature classes updated with Python script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/not-all-feature-classes-updated-with-python-script/m-p/175585#M13509</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am experiencing a strange issue, not all the feature classes have been updated when running the following python script in ModelBuilder&lt;/P&gt;&lt;P&gt;The filegeodatabase has a total of 9 feature classes (six of the feature classes have been updated and three are not), no errors are shown in ModelBuilder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/198094_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the script I am running:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Import system modules&lt;/P&gt;&lt;P&gt;import arcpy, os&lt;/P&gt;&lt;P&gt;from arcpy import env&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#Set the workspace so that Python knows where to look for the feature classes.&lt;/P&gt;&lt;P&gt;# In this case, it is a GDB&lt;/P&gt;&lt;P&gt;arcpy.env.workspace = r'D:/spatial_data/parcel_data/scratchdb.gdb'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# list the feature classes&lt;/P&gt;&lt;P&gt;fcList = arcpy.ListFeatureClasses()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# loop through list&lt;/P&gt;&lt;P&gt;for fc in fcList:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #check if field exists, if not, add it and calculate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if "RegCode" not in arcpy.ListFields (fc):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fc, "RegCode", "TEXT", "", "", field_length = &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if "IdCode" not in arcpy.ListFields (fc):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fc, "IdCode", "TEXT", "", "", field_length = &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if "PNoCreate" not in arcpy.ListFields (fc):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fc, "PNoCreate", "TEXT", "", "", field_length = &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if "PnNoCreate" not in arcpy.ListFields (fc):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fc, "PnNoCreate", "TEXT", "", "", field_length = 5)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if "IdCreate" not in arcpy.ListFields (fc):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fc, "IdCreate", "TEXT", "", "", field_length = 21)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 May 2016 20:16:00 GMT</pubDate>
    <dc:creator>MaziziJama</dc:creator>
    <dc:date>2016-05-03T20:16:00Z</dc:date>
    <item>
      <title>Not all feature classes updated with Python script</title>
      <link>https://community.esri.com/t5/python-questions/not-all-feature-classes-updated-with-python-script/m-p/175585#M13509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am experiencing a strange issue, not all the feature classes have been updated when running the following python script in ModelBuilder&lt;/P&gt;&lt;P&gt;The filegeodatabase has a total of 9 feature classes (six of the feature classes have been updated and three are not), no errors are shown in ModelBuilder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/198094_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the script I am running:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Import system modules&lt;/P&gt;&lt;P&gt;import arcpy, os&lt;/P&gt;&lt;P&gt;from arcpy import env&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#Set the workspace so that Python knows where to look for the feature classes.&lt;/P&gt;&lt;P&gt;# In this case, it is a GDB&lt;/P&gt;&lt;P&gt;arcpy.env.workspace = r'D:/spatial_data/parcel_data/scratchdb.gdb'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# list the feature classes&lt;/P&gt;&lt;P&gt;fcList = arcpy.ListFeatureClasses()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# loop through list&lt;/P&gt;&lt;P&gt;for fc in fcList:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #check if field exists, if not, add it and calculate&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if "RegCode" not in arcpy.ListFields (fc):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fc, "RegCode", "TEXT", "", "", field_length = &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if "IdCode" not in arcpy.ListFields (fc):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fc, "IdCode", "TEXT", "", "", field_length = &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if "PNoCreate" not in arcpy.ListFields (fc):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fc, "PNoCreate", "TEXT", "", "", field_length = &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if "PnNoCreate" not in arcpy.ListFields (fc):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fc, "PnNoCreate", "TEXT", "", "", field_length = 5)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if "IdCreate" not in arcpy.ListFields (fc):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fc, "IdCreate", "TEXT", "", "", field_length = 21)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 May 2016 20:16:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/not-all-feature-classes-updated-with-python-script/m-p/175585#M13509</guid>
      <dc:creator>MaziziJama</dc:creator>
      <dc:date>2016-05-03T20:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: Not all feature classes updated with Python script</title>
      <link>https://community.esri.com/t5/python-questions/not-all-feature-classes-updated-with-python-script/m-p/175586#M13510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;which begs the question... which ones and which field(s) didn't get updated? could it be that a few aren't featureclasses but tables?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 May 2016 20:47:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/not-all-feature-classes-updated-with-python-script/m-p/175586#M13510</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-05-03T20:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: Not all feature classes updated with Python script</title>
      <link>https://community.esri.com/t5/python-questions/not-all-feature-classes-updated-with-python-script/m-p/175587#M13511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All of them are feature classes.&lt;/P&gt;&lt;P&gt;I am using the script to add multiple fields using the python script.&lt;/P&gt;&lt;P&gt;I have also attached a sample filegeodatabase.&lt;/P&gt;&lt;P&gt;I am only able to add the fields to the Farm_Portion feature class.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 May 2016 22:14:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/not-all-feature-classes-updated-with-python-script/m-p/175587#M13511</guid>
      <dc:creator>MaziziJama</dc:creator>
      <dc:date>2016-05-03T22:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Not all feature classes updated with Python script</title>
      <link>https://community.esri.com/t5/python-questions/not-all-feature-classes-updated-with-python-script/m-p/175588#M13512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;to save a download and inspect, did you consider placin a print statement after the listfeature classes to see what was listed and perhaps a print statement after you get a list of the field names to compare to a list of field names as in example 2 in the help topic&lt;/P&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/listfields.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-functions/listfields.htm"&gt;ListFields—Help | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 May 2016 22:38:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/not-all-feature-classes-updated-with-python-script/m-p/175588#M13512</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-05-03T22:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: Not all feature classes updated with Python script</title>
      <link>https://community.esri.com/t5/python-questions/not-all-feature-classes-updated-with-python-script/m-p/175589#M13513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I added - arcpy.SetLogHistory(True)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;# Import system modules&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;import arcpy, os&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;from arcpy import env&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;arcpy.SetLogHistory(True)&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;...&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;The script is running as expected for all feature classes -&amp;nbsp; all the fields are added.&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;As to why the script was not executing as expected, I am still not sure of what the problem is.&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif; color: #3d3d3d;"&gt;Thanks Dan for some pointers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 May 2016 23:24:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/not-all-feature-classes-updated-with-python-script/m-p/175589#M13513</guid>
      <dc:creator>MaziziJama</dc:creator>
      <dc:date>2016-05-03T23:24:27Z</dc:date>
    </item>
    <item>
      <title>Re: Not all feature classes updated with Python script</title>
      <link>https://community.esri.com/t5/python-questions/not-all-feature-classes-updated-with-python-script/m-p/175590#M13514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;glad to hear it worked out&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 May 2016 23:26:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/not-all-feature-classes-updated-with-python-script/m-p/175590#M13514</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-05-03T23:26:12Z</dc:date>
    </item>
  </channel>
</rss>

