<?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: TypeError: 'Row' object is not subscriptable in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/typeerror-row-object-is-not-subscriptable/m-p/1518553#M86799</link>
    <description>&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/data-access/searchcursor-class.htm" target="_blank"&gt;SearchCursor—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;see example 2 for da.SearchCursor and a single field&lt;/P&gt;</description>
    <pubDate>Mon, 12 Aug 2024 19:02:28 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2024-08-12T19:02:28Z</dc:date>
    <item>
      <title>TypeError: 'Row' object is not subscriptable</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/typeerror-row-object-is-not-subscriptable/m-p/1518539#M86795</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm have the following code trying to compare a field of different feature classes:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
input_table = arcpy.GetParameterAsText(0)
input_fld = arcpy.GetParameterAsText(1)
compare_table = arcpy.GetParameterAsText(2)
compare_fld = arcpy.GetParameterAsText(3)
arcpy.AddMessage(input_fld)
#create a search cursor for the compare table
compare_cursor = arcpy.SearchCursor(dataset=compare_table, fields=compare_fld)
#create a set of all values in the compare cursor
compare_set = set()
for row in compare_cursor:
    arcpy.AddMessage(row[0])
    compare_set.add(row[0])
arcpy.AddMessage(compare_set)
#add a "compare field" if this is not already present 
input_fields = arcpy.ListFields(input_table)
if not "Compare" in input_fields:
    arcpy.management.AddField(input_table, "Compare", "TEXT")
#log if the value in the input fields exist in the compare table, by marking "yes" or "no" in the "compare" field
update_curs = arcpy.UpdateCursor(input_table, [input_fld, "Compare"])
for row in update_curs:
    if row in compare_set:
        row[0] = "YES"
    else:
        row[0] = "NO"
    update_curs.updateRow(row)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This give me the following error, shouldn't a row in a search cursor be subscriptable by default?&lt;/P&gt;&lt;P&gt;field_compare&lt;BR /&gt;=====================&lt;BR /&gt;Parameters&lt;/P&gt;&lt;P&gt;Input Table E:\Users\58303\Documents\ArcGIS\Projects\test.gdb\Input_table&lt;BR /&gt;Input Field Input_field&lt;BR /&gt;Compare Table E:\Users\58303\Documents\ArcGIS\Projects\test.gdb\Compare_table&lt;BR /&gt;Compare Field Compare_Field&lt;BR /&gt;=====================&lt;BR /&gt;Messages&lt;/P&gt;&lt;P&gt;Start Time: Monday, August 12, 2024 2:39:21 PM&lt;BR /&gt;Input_field&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;File "E:\Users\58303\Documents\ArcGIS\Projects\Experimental.atbx#fieldcompare_NewToolbox.py", line 13, in &amp;lt;module&amp;gt;&lt;BR /&gt;TypeError: 'Row' object is not subscriptable&lt;/P&gt;&lt;P&gt;Failed script field_compare...&lt;BR /&gt;Failed to execute (fieldcompare).&lt;BR /&gt;Failed at Monday, August 12, 2024 2:39:21 PM (Elapsed Time: 0.43 seconds)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 18:43:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/typeerror-row-object-is-not-subscriptable/m-p/1518539#M86795</guid>
      <dc:creator>rescobar</dc:creator>
      <dc:date>2024-08-12T18:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: TypeError: 'Row' object is not subscriptable</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/typeerror-row-object-is-not-subscriptable/m-p/1518550#M86798</link>
      <description>&lt;P&gt;You are mixing the two types of cursors in ArcPy; specifically, you are using the old-style cursor and trying to use new-style syntax.&amp;nbsp; See &lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/get-started/data-access-using-cursors.htm#:~:text=Cursors%20have%20three%20forms%3A%20search,feature%20class%2C%20or%20feature%20layer." target="_blank"&gt;Data access using cursors—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 18:56:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/typeerror-row-object-is-not-subscriptable/m-p/1518550#M86798</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2024-08-12T18:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: TypeError: 'Row' object is not subscriptable</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/typeerror-row-object-is-not-subscriptable/m-p/1518553#M86799</link>
      <description>&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/data-access/searchcursor-class.htm" target="_blank"&gt;SearchCursor—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;see example 2 for da.SearchCursor and a single field&lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2024 19:02:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/typeerror-row-object-is-not-subscriptable/m-p/1518553#M86799</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2024-08-12T19:02:28Z</dc:date>
    </item>
  </channel>
</rss>

