<?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: AttributeError: 'list' object has no attribute 'setValue' on the line s.setValue(RouteName, cr) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/attributeerror-list-object-has-no-attribute/m-p/65021#M5340</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;She is mixing the syntax between the two styles of cursors.&amp;nbsp; She is using a Data Access cursor (arcpy.da.UpdateCursor), but she is using the syntax for the older ArcPy Cursor (arcpy.UpdateCursor).&amp;nbsp; Have her review &lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/data-access/updatecursor-class.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/data-access/updatecursor-class.htm"&gt;UpdateCursor—ArcGIS Pro | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Aug 2020 17:53:16 GMT</pubDate>
    <dc:creator>JoshuaBixby</dc:creator>
    <dc:date>2020-08-17T17:53:16Z</dc:date>
    <item>
      <title>AttributeError: 'list' object has no attribute 'setValue' on the line s.setValue(RouteName, cr)</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-list-object-has-no-attribute/m-p/65020#M5339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;one of my staff members is having trouble accessing GeoNet and has this question:&lt;A href="https://community.esri.com/migrated-users/130756" target="_blank"&gt;Laura Conner&lt;/A&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;I am trying to get several routes to combine in to one route. I have created the sub routs and are now trying to combine them with a python script.&lt;/P&gt;&lt;P&gt;The error I am currently running in to is &lt;SPAN style="color: #ff6600;"&gt;&lt;STRONG style="font-size: 10pt; "&gt;AttributeError: 'list' object has no attribute 'setValue'&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="font-size: 9.0pt;"&gt;on the line &lt;/SPAN&gt;&lt;SPAN style="font-size: 10.0pt; color: #385723;"&gt;s.setValue(RouteName, cr)&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; color: #385723;"&gt;. &lt;/SPAN&gt;From what I can tell this means object s a list can’t handle the setValue method. Yet from all the examples I have seen I am using the same syntax as the examples given by esri on the &lt;SPAN style="color: #2493f2;"&gt;arcpy.da.UpdateCursor &lt;/SPAN&gt;documentation and other examples. the only difference I can see is variables. Even when try as one forum suggested:&lt;SPAN style="font-size: 9.0pt;"&gt; &lt;SPAN style="color: #2493f2;"&gt;s&lt;/SPAN&gt;&lt;SPAN style="color: #6a6a6a;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #6a6a6a;"&gt;].&lt;/SPAN&gt;&lt;SPAN style="color: #2493f2;"&gt;setValue&lt;/SPAN&gt;&lt;SPAN style="color: #6a6a6a;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #2493f2;"&gt;RouteName&lt;/SPAN&gt;&lt;SPAN style="color: #6a6a6a;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #2493f2;"&gt;cr&lt;/SPAN&gt;&lt;SPAN style="color: #6a6a6a;"&gt;) &lt;/SPAN&gt;&lt;/SPAN&gt;it gives &lt;SPAN style="color: #ff6600;"&gt;&lt;STRONG style="font-size: 9pt; "&gt;AttributeError: 'str' object has no attribute 'setValue&lt;/STRONG&gt;&lt;/SPAN&gt; for the respective line.&lt;/P&gt;&lt;P&gt;How do I get my script working to update both fields of the feature class up date?&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="font-size: 9.0pt;"&gt;# internal script for concating subroutes in to larger routs&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;rln = ["1N-1","1N-2"]# list of sub route names to be concatinated &lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;r=0 # last highest value sarts at 0&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;fc = r'C:\Users\lconner\OneDrive - Macon Water Authority\projects\curbs and gutters in the county\Swepper_Routes_2\Swepper_Routes_2_1.gdb\Route1\Stops1'&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;#feature class the concatination is to be preformed on&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;rsn =['RouteName','Sequence'] #list of feilds needed route name and sequence&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;cr= '1NCB' # name of concatinated route&lt;/SPAN&gt;

&lt;SPAN style="font-size: 9.0pt;"&gt;# sn = sequence number the&amp;nbsp; stop will have in the conacted route&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;# s= stops in the subroute&lt;/SPAN&gt;

&lt;SPAN style="font-size: 9.0pt;"&gt;&amp;nbsp;&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;for e in rln:&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; #get records where route name feild = e&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.UpdateCursor(fc,['RouteName','Sequence']) as sl:&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # str('RouteName' == e)&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # right sequence number to list =snl&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # order list &lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for s in sl:&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sn=r=r+1&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # wright sn to atrabute of the main route&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s[1]= sn&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s[0]= cr&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s.setValue(RouteName, cr)&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; s.setValue(Sequence, sn)&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sl.updateRow(s)&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; del sl&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;more details:&lt;/P&gt;&lt;P&gt;Arc Pro: 2.6&lt;/P&gt;&lt;P&gt;Run in python widow in the respective project&lt;/P&gt;&lt;P&gt;Windows: 10 pro 64 bit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 15:59:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-list-object-has-no-attribute/m-p/65020#M5339</guid>
      <dc:creator>wilcow</dc:creator>
      <dc:date>2021-12-12T15:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: AttributeError: 'list' object has no attribute 'setValue' on the line s.setValue(RouteName, cr)</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-list-object-has-no-attribute/m-p/65021#M5340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;She is mixing the syntax between the two styles of cursors.&amp;nbsp; She is using a Data Access cursor (arcpy.da.UpdateCursor), but she is using the syntax for the older ArcPy Cursor (arcpy.UpdateCursor).&amp;nbsp; Have her review &lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/data-access/updatecursor-class.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/data-access/updatecursor-class.htm"&gt;UpdateCursor—ArcGIS Pro | Documentation&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Aug 2020 17:53:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-list-object-has-no-attribute/m-p/65021#M5340</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2020-08-17T17:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: AttributeError: 'list' object has no attribute 'setValue' on the line s.setValue(RouteName, cr)</title>
      <link>https://community.esri.com/t5/python-questions/attributeerror-list-object-has-no-attribute/m-p/65022#M5341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you that has solved the problem. removing the set values allowed the code to successfully run and up date the table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Aug 2020 13:42:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/attributeerror-list-object-has-no-attribute/m-p/65022#M5341</guid>
      <dc:creator>wilcow</dc:creator>
      <dc:date>2020-08-18T13:42:26Z</dc:date>
    </item>
  </channel>
</rss>

