<?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 using da.UpdateCursor's updateRow(row) I get &amp;quot;TypeError: value #1 - unsupported type: list in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/using-da-updatecursor-s-updaterow-row-i-get-quot/m-p/1306700#M68115</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I am running a python script I wrote from a geoprocessing toolbox.&amp;nbsp; Essentially, its purpose is to take data from an excel file and update specific rows in the feature class attribute table.&amp;nbsp; Most of the script works, but I tried to add some additional functionality to create a new field in the table and populate it, and this is the portion that broke.&lt;/P&gt;&lt;P&gt;The problem function is as follows:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;## Funtion to create a new XPNUMDATAX field in arcGIS table and populate it using a prefix and APN
def makePNUMDATA(countyItem, boolItem, workspace, fc):

    prefix = 'default'

    arcpy.AddMessage(f"boolItem: {boolItem}")
    arcpy.AddMessage(f"countyItem: {countyItem}")

    if boolItem == "'true'":
        if countyItem == "'stanislaus'":
            ## Create variable used to modify APN
            prefix = ' '
        if countyItem == 'merced':
            ## Create variable used to modify APN
            prefix = 'M'

        ## Add XPNUMDATAX Field to the table
        arcpy.management.AddField(fc, 'XPNUMDATAX', 'TEXT')


        txFields = ['APN', 'XPNUMDATAX']

        ## Iterate table and update XPNUMDATAX field with prefix + APN
        with arcpy.da.Editor(workspace) as edit:
            ## Declare update cursor
            with arcpy.da.UpdateCursor(fc, txFields) as cursor:
                for row in cursor:
                    apnVal = row[0]
                    apnVal = str(apnVal)
                    newPNUM = [prefix + apnVal]
                    row[1] = newPNUM
                    cursor.updateRow(row)&lt;/LI-CODE&gt;&lt;P&gt;This does create the XPNUMDATAX field, and through various print statements I have verified that it does indeed calculate the newPNUM value intended to populate the field.&amp;nbsp; However, I get this error:&lt;/P&gt;&lt;LI-CODE lang="markdown"&gt;Traceback (most recent call last):
  File "C:\Users\twhammond\Documents\tommy_misc\dataProject\testFiles\scripts\updateFromExcel3.py", line 274, in &amp;lt;module&amp;gt;
    makePNUMDATA(countyList[fcIndex], boolList[fcIndex], workspace, fcList[fcIndex])
  File "C:\Users\twhammond\Documents\tommy_misc\dataProject\testFiles\scripts\updateFromExcel3.py", line 230, in makePNUMDATA
    cursor.updateRow(row)
TypeError: value #1 - unsupported type: list&lt;/LI-CODE&gt;&lt;P&gt;From all the documentation, it seems as if the cursor.updateRow() method takes a list or tuple as its parameter.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="twhammond_0-1688764612966.png" style="width: 612px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/75031i8F59CEE527DB0A19/image-dimensions/612x225?v=v2" width="612" height="225" role="button" title="twhammond_0-1688764612966.png" alt="twhammond_0-1688764612966.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I missing here?&amp;nbsp; The row is a list object and is taken into a method that only accepts lists and tuples, so why am I getting this type error?&lt;/P&gt;&lt;P&gt;Other details:&lt;/P&gt;&lt;P&gt;I am using ArcGIS Pro 2.9.9&lt;/P&gt;&lt;P&gt;I am familiar with python but have only been using arcpy and arcGIS for a couple weeks.&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jul 2023 21:19:10 GMT</pubDate>
    <dc:creator>twhammond</dc:creator>
    <dc:date>2023-07-07T21:19:10Z</dc:date>
    <item>
      <title>using da.UpdateCursor's updateRow(row) I get "TypeError: value #1 - unsupported type: list</title>
      <link>https://community.esri.com/t5/python-questions/using-da-updatecursor-s-updaterow-row-i-get-quot/m-p/1306700#M68115</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;I am running a python script I wrote from a geoprocessing toolbox.&amp;nbsp; Essentially, its purpose is to take data from an excel file and update specific rows in the feature class attribute table.&amp;nbsp; Most of the script works, but I tried to add some additional functionality to create a new field in the table and populate it, and this is the portion that broke.&lt;/P&gt;&lt;P&gt;The problem function is as follows:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;## Funtion to create a new XPNUMDATAX field in arcGIS table and populate it using a prefix and APN
def makePNUMDATA(countyItem, boolItem, workspace, fc):

    prefix = 'default'

    arcpy.AddMessage(f"boolItem: {boolItem}")
    arcpy.AddMessage(f"countyItem: {countyItem}")

    if boolItem == "'true'":
        if countyItem == "'stanislaus'":
            ## Create variable used to modify APN
            prefix = ' '
        if countyItem == 'merced':
            ## Create variable used to modify APN
            prefix = 'M'

        ## Add XPNUMDATAX Field to the table
        arcpy.management.AddField(fc, 'XPNUMDATAX', 'TEXT')


        txFields = ['APN', 'XPNUMDATAX']

        ## Iterate table and update XPNUMDATAX field with prefix + APN
        with arcpy.da.Editor(workspace) as edit:
            ## Declare update cursor
            with arcpy.da.UpdateCursor(fc, txFields) as cursor:
                for row in cursor:
                    apnVal = row[0]
                    apnVal = str(apnVal)
                    newPNUM = [prefix + apnVal]
                    row[1] = newPNUM
                    cursor.updateRow(row)&lt;/LI-CODE&gt;&lt;P&gt;This does create the XPNUMDATAX field, and through various print statements I have verified that it does indeed calculate the newPNUM value intended to populate the field.&amp;nbsp; However, I get this error:&lt;/P&gt;&lt;LI-CODE lang="markdown"&gt;Traceback (most recent call last):
  File "C:\Users\twhammond\Documents\tommy_misc\dataProject\testFiles\scripts\updateFromExcel3.py", line 274, in &amp;lt;module&amp;gt;
    makePNUMDATA(countyList[fcIndex], boolList[fcIndex], workspace, fcList[fcIndex])
  File "C:\Users\twhammond\Documents\tommy_misc\dataProject\testFiles\scripts\updateFromExcel3.py", line 230, in makePNUMDATA
    cursor.updateRow(row)
TypeError: value #1 - unsupported type: list&lt;/LI-CODE&gt;&lt;P&gt;From all the documentation, it seems as if the cursor.updateRow() method takes a list or tuple as its parameter.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="twhammond_0-1688764612966.png" style="width: 612px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/75031i8F59CEE527DB0A19/image-dimensions/612x225?v=v2" width="612" height="225" role="button" title="twhammond_0-1688764612966.png" alt="twhammond_0-1688764612966.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I missing here?&amp;nbsp; The row is a list object and is taken into a method that only accepts lists and tuples, so why am I getting this type error?&lt;/P&gt;&lt;P&gt;Other details:&lt;/P&gt;&lt;P&gt;I am using ArcGIS Pro 2.9.9&lt;/P&gt;&lt;P&gt;I am familiar with python but have only been using arcpy and arcGIS for a couple weeks.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2023 21:19:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-da-updatecursor-s-updaterow-row-i-get-quot/m-p/1306700#M68115</guid>
      <dc:creator>twhammond</dc:creator>
      <dc:date>2023-07-07T21:19:10Z</dc:date>
    </item>
    <item>
      <title>Re: using da.UpdateCursor's updateRow(row) I get "TypeError: value #1 - unsupported type: list</title>
      <link>https://community.esri.com/t5/python-questions/using-da-updatecursor-s-updaterow-row-i-get-quot/m-p/1306720#M68117</link>
      <description>&lt;P&gt;&lt;EM&gt;A list (or tuple) of field names. For a single field, you can use a string instead of a list of strings.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Since you are using a single field in the updatecursor, did you try a string instead of a list&lt;/P&gt;&lt;LI-CODE lang="python"&gt;newPNUM = prefix + apnVal&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2023 21:52:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-da-updatecursor-s-updaterow-row-i-get-quot/m-p/1306720#M68117</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-07-07T21:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: using da.UpdateCursor's updateRow(row) I get "TypeError: value #1 - unsupported type: list</title>
      <link>https://community.esri.com/t5/python-questions/using-da-updatecursor-s-updaterow-row-i-get-quot/m-p/1306723#M68118</link>
      <description>&lt;P&gt;I was completely misinterpreting the error.&amp;nbsp; I thought &lt;EM&gt;row&lt;/EM&gt; was the parameter causing issues and didn't even notice that &lt;EM&gt;newPNUM&lt;/EM&gt; was a list.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks! That solved the problem for me.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2023 22:01:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/using-da-updatecursor-s-updaterow-row-i-get-quot/m-p/1306723#M68118</guid>
      <dc:creator>twhammond</dc:creator>
      <dc:date>2023-07-07T22:01:03Z</dc:date>
    </item>
  </channel>
</rss>

