<?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: Attribute not set to NULL in python script using UpdateCursor in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-not-set-to-null-in-python-script-using/m-p/1671368#M100697</link>
    <description>&lt;P&gt;is it a featureclass in a geodatabase that you are tryig to update? or a shapefile? (which doesn't support null&lt;/P&gt;</description>
    <pubDate>Mon, 08 Dec 2025 19:38:37 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2025-12-08T19:38:37Z</dc:date>
    <item>
      <title>Attribute not set to NULL in python script using UpdateCursor</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-not-set-to-null-in-python-script-using/m-p/1671358#M100696</link>
      <description>&lt;P&gt;When I set a field to None in an arcpy script, it shows as None in the attribute table rather than &amp;lt;Null&amp;gt; when using an UpdateCursor.&amp;nbsp; Why does it set it to a text value of "None" rather than &amp;lt;Null&amp;gt;?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# ---------------------------------------------------------------
# Loop through NEW to OLD spatial join results
#     If attributes don't match, then show the differences in the
#     new Changes_ attribute fields.
# ---------------------------------------------------------------
with arcpy.da.UpdateCursor(
    fc, fields, where_clause = "Join_Count=1"
) as cursor:
    for row in cursor:
        myADDR = ""
                                   
        #Compare L_F_ADD = L_F_ADD_1 and L_T_ADD = L_T_ADD_1 and R_F_ADD = R_F_ADD_1 and R_T_ADD = R_T_ADD_1
        if row[4] != row[24]: 
            myADDR += "L_F_ADD (new = old): " + str(row[4]) + "=" + str(row[24]) + " | "
        if row[5] != row[25]:
            myADDR += "L_T_ADD (new = old): " + str(row[5]) + "=" + str(row[25]) + " | "
        if row[6] != row[26]:
            myADDR += "R_F_ADD (new = old): " + str(row[6]) + "=" + str(row[26]) + " | "
        if row[7] != row[27]:
            myADDR += "R_T_ADD (new = old): " + str(row[7]) + "=" + str(row[27]) + " | "
             
              
        if myADDR == "":
            myADDR = None
                    
        row[43] = myADDR
               
        cursor.updateRow(row)&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 08 Dec 2025 19:15:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-not-set-to-null-in-python-script-using/m-p/1671358#M100696</guid>
      <dc:creator>LoriEmersonKDOT</dc:creator>
      <dc:date>2025-12-08T19:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute not set to NULL in python script using UpdateCursor</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-not-set-to-null-in-python-script-using/m-p/1671368#M100697</link>
      <description>&lt;P&gt;is it a featureclass in a geodatabase that you are tryig to update? or a shapefile? (which doesn't support null&lt;/P&gt;</description>
      <pubDate>Mon, 08 Dec 2025 19:38:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-not-set-to-null-in-python-script-using/m-p/1671368#M100697</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2025-12-08T19:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute not set to NULL in python script using UpdateCursor</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-not-set-to-null-in-python-script-using/m-p/1671369#M100698</link>
      <description>&lt;P&gt;That's super odd. Do you have the same problem with a different table?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Dec 2025 19:39:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-not-set-to-null-in-python-script-using/m-p/1671369#M100698</guid>
      <dc:creator>AlfredBaldenweck</dc:creator>
      <dc:date>2025-12-08T19:39:22Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute not set to NULL in python script using UpdateCursor</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-not-set-to-null-in-python-script-using/m-p/1671384#M100700</link>
      <description>&lt;P&gt;In this case, i.e., trying to NULL a shape file field that doesn't know/support NULL, the DA update cursor will generate a RuntimeError instead of populating the field with "None":&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Traceback (most recent call last):
  File "&amp;lt;string&amp;gt;", line 4, in &amp;lt;module&amp;gt;
RuntimeError: The field is not nullable. [TXT_FLD]&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 08 Dec 2025 20:58:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-not-set-to-null-in-python-script-using/m-p/1671384#M100700</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2025-12-08T20:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute not set to NULL in python script using UpdateCursor</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-not-set-to-null-in-python-script-using/m-p/1671387#M100701</link>
      <description>&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;It's a feature class in a file geodatabase.&amp;nbsp; I even set the Default value to NULL (None) when adding the new field, so I know it accepts nulls.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="UpdateCursorNullField.png" style="width: 921px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/145027i05B0AE8798FEF5F8/image-size/large?v=v2&amp;amp;px=999" role="button" title="UpdateCursorNullField.png" alt="UpdateCursorNullField.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Dec 2025 21:10:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-not-set-to-null-in-python-script-using/m-p/1671387#M100701</guid>
      <dc:creator>LoriEmersonKDOT</dc:creator>
      <dc:date>2025-12-08T21:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: Attribute not set to NULL in python script using UpdateCursor</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/attribute-not-set-to-null-in-python-script-using/m-p/1671402#M100702</link>
      <description>&lt;P&gt;I fixed the problem by removing the Default of None when adding the field to the existing feature class attribute table.&amp;nbsp; Now the python assignment of None works when performing the updateRow within the UpdateCursor.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="UpdateCursorDefaultValue.png" style="width: 922px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/145035i37824FBE79B48C50/image-size/large?v=v2&amp;amp;px=999" role="button" title="UpdateCursorDefaultValue.png" alt="UpdateCursorDefaultValue.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Dec 2025 21:47:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/attribute-not-set-to-null-in-python-script-using/m-p/1671402#M100702</guid>
      <dc:creator>LoriEmersonKDOT</dc:creator>
      <dc:date>2025-12-08T21:47:42Z</dc:date>
    </item>
  </channel>
</rss>

