<?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: Arcpy: AddField is not adding a field and not giving any error in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-addfield-is-not-adding-a-field-and-not/m-p/1117893#M47950</link>
    <description>&lt;P&gt;strange... but you use "&lt;SPAN&gt;fc" try using the full path&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;full_path =&amp;nbsp;&amp;nbsp; "G:\\Game_program\\Web_maps\\Controlled_Hunt\\Controlled_Hunt.gdb\\Map_Series_Extents"&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Nov 2021 20:50:02 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2021-11-17T20:50:02Z</dc:date>
    <item>
      <title>Arcpy: AddField is not adding a field and not giving any error</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-addfield-is-not-adding-a-field-and-not/m-p/1117869#M47947</link>
      <description>&lt;P&gt;Hello, writing a script to generate all the extents of a map series so they can be displayed in the extent map.&lt;/P&gt;&lt;P&gt;Here is my relevant code:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;p = arcpy.mp.ArcGISProject("G:\\Game_program\\Web_maps\\Controlled_Hunt\\Controlled_Hunt.aprx")&lt;BR /&gt;arcpy.env.addOutputsToMap = True&lt;BR /&gt;gdb = "G:\\Game_program\\Web_maps\\Controlled_Hunt\\Controlled_Hunt.gdb"&lt;BR /&gt;fc = 'Map_Series_Extents'&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;arcpy.CreateFeatureclass_management(gdb, fc, "POLYGON",&lt;BR /&gt;has_m = "DISABLED", has_z = "DISABLED",&lt;BR /&gt;spatial_reference = "G:\\Game_program\\Web_maps\\Controlled_Hunt\\Controlled_Hunt.gdb\\Divided_ControlledHunt_tobeMapped_2022")&lt;/P&gt;&lt;P&gt;arcpy.management.AddField(fc, "Name", "TEXT")&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For whatever reason the field just stopped getting added and there are no errors that come up when I run the code. I know it worked at some point.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Nov 2021 19:58:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-addfield-is-not-adding-a-field-and-not/m-p/1117869#M47947</guid>
      <dc:creator>ChrisCowin</dc:creator>
      <dc:date>2021-11-17T19:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy: AddField is not adding a field and not giving any error</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-addfield-is-not-adding-a-field-and-not/m-p/1117893#M47950</link>
      <description>&lt;P&gt;strange... but you use "&lt;SPAN&gt;fc" try using the full path&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;full_path =&amp;nbsp;&amp;nbsp; "G:\\Game_program\\Web_maps\\Controlled_Hunt\\Controlled_Hunt.gdb\\Map_Series_Extents"&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Nov 2021 20:50:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-addfield-is-not-adding-a-field-and-not/m-p/1117893#M47950</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-11-17T20:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy: AddField is not adding a field and not giving any error</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcpy-addfield-is-not-adding-a-field-and-not/m-p/1117923#M47954</link>
      <description>&lt;P&gt;E: after looking at it more i thought the copy features would insert a polygon object into the existing Feature Class not just completely overwrite it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Same result when it is in the same spot as my code, but works when I run it independently. But then when I run the rest of my code it goes away.. I'm not deleting anything, I have no idea why this is happeneing and its so frustrating. Here is all of my code for when I'm manually making the feature class:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;p = arcpy.mp.ArcGISProject("G:\\Game_program\\Web_maps\\Controlled_Hunt\\Controlled_Hunt.aprx")&lt;BR /&gt;arcpy.env.addOutputsToMap = True&lt;BR /&gt;gdb = "G:\\Game_program\\Web_maps\\Controlled_Hunt\\Controlled_Hunt.gdb"&lt;BR /&gt;fc = 'Map_Series_Extents'&lt;/P&gt;&lt;P&gt;# arcpy.CreateFeatureclass_management(gdb, fc, "POLYGON",&lt;BR /&gt;# has_m = "DISABLED", has_z = "DISABLED",&lt;BR /&gt;# spatial_reference = "G:\\Game_program\\Web_maps\\Controlled_Hunt\\Controlled_Hunt.gdb\\Divided_ControlledHunt_tobeMapped_2022")&lt;/P&gt;&lt;P&gt;# arcpy.AddField_management("G:\\Game_program\\Web_maps\\Controlled_Hunt\\Controlled_Hunt.gdb\\Map_Series_Extents", "Name", "TEXT")&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;l = p.listLayouts()[2]&lt;/P&gt;&lt;P&gt;if not l.mapSeries is None:&lt;BR /&gt;ms = l.mapSeries&lt;BR /&gt;if ms.enabled:&lt;BR /&gt;for pageNum in range(1, ms.pageCount + 1):&lt;BR /&gt;# Loop through the pages&lt;BR /&gt;ms.currentPageNumber = pageNum&lt;BR /&gt;&lt;BR /&gt;# Get the Map Name&lt;BR /&gt;pageName = ms.pageNameField&lt;BR /&gt;&lt;BR /&gt;# Get the Map Frame&lt;BR /&gt;mf = l.listElements("mapframe_element", "Map Frame")[0]&lt;BR /&gt;&lt;BR /&gt;# Generate extent from the Map Frame&lt;BR /&gt;extent = mf.camera.getExtent()&lt;BR /&gt;polygon = extent.polygon&lt;/P&gt;&lt;P&gt;# Insert the polygon into a feature class&lt;BR /&gt;arcpy.CopyFeatures_management(polygon, gdb + '\\' + fc)&lt;BR /&gt;&lt;BR /&gt;# Add field to polygon&lt;BR /&gt;with arcpy.da.UpdateCursor(gdb + '\\' + fc, ['Name']) as cursor:&lt;BR /&gt;for row in cursor:&lt;BR /&gt;if not row[0]:&lt;BR /&gt;row[0] = pageName&lt;BR /&gt;cursor.updateRow(row)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Wed, 17 Nov 2021 21:45:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcpy-addfield-is-not-adding-a-field-and-not/m-p/1117923#M47954</guid>
      <dc:creator>ChrisCowin</dc:creator>
      <dc:date>2021-11-17T21:45:12Z</dc:date>
    </item>
  </channel>
</rss>

