<?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: Problem in Inserting Row in shape file using Python, in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/problem-in-inserting-row-in-shape-file-using/m-p/483879#M16239</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ahsan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will just need to change the line:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14182130796131806 jive_text_macro" jivemacro_uid="_14182130796131806"&gt;&lt;P&gt;cursor.updateRow([row])&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14182130860608019 jive_text_macro" jivemacro_uid="_14182130860608019"&gt;&lt;P&gt;cursor.updateRow(row)&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and your code should work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Dec 2014 12:04:58 GMT</pubDate>
    <dc:creator>JakeSkinner</dc:creator>
    <dc:date>2014-12-10T12:04:58Z</dc:date>
    <item>
      <title>Problem in Inserting Row in shape file using Python,</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/problem-in-inserting-row-in-shape-file-using/m-p/483878#M16238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;&lt;STRONG&gt;Complete problem to solve ?&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: GarthGraphicStd; font-size: 10pt; color: #231f20;"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"&gt;Write a script that adds a text field to the roads.shp feature class called &lt;/SPAN&gt;&lt;SPAN style="font-family: GarthGraphicStd-Bold; font-size: 10pt;"&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"&gt;&lt;STRONG&gt;FERRY &lt;/STRONG&gt;and populates this field with YES and NO values, depending on the value of the FEATURE field.&lt;/SPAN&gt;&lt;BR style="text-align: -webkit-auto;" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #231f20; font-size: 12pt; font-family: arial, helvetica, sans-serif;"&gt;Below is my code, but i got an error (" sequence size must match size of the row "), Please help me...&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/confused.png" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fc = "roads.shp"&lt;/P&gt;&lt;P&gt;newfield = "FERRY"&lt;/P&gt;&lt;P&gt;fieldtype = "TEXT"&lt;/P&gt;&lt;P&gt;fieldname = arcpy.ValidateFieldName(newfield)&lt;/P&gt;&lt;P&gt;fieldlist = arcpy.ListFields(fc)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if fieldname not in fieldlist:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(fc, fieldname, fieldtype, "", "", 12)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "New field has been added."&lt;/P&gt;&lt;P&gt;else:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Field name already exists."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cursor = arcpy.da.UpdateCursor(fc, ["FEATURE","FERRY"])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for row in cursor:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if row[0] == "Ferry Crossing":&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #print row[0]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #cursor.insertRow("YES")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[1] = "YES"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #print row[0]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #row.insertRow("NO")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row[1] = "NO"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cursor.updateRow([row])&lt;/P&gt;&lt;P&gt;del row&lt;/P&gt;&lt;P&gt;del cursor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2014 07:44:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/problem-in-inserting-row-in-shape-file-using/m-p/483878#M16238</guid>
      <dc:creator>AhsanAbbas</dc:creator>
      <dc:date>2014-12-10T07:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in Inserting Row in shape file using Python,</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/problem-in-inserting-row-in-shape-file-using/m-p/483879#M16239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ahsan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will just need to change the line:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14182130796131806 jive_text_macro" jivemacro_uid="_14182130796131806"&gt;&lt;P&gt;cursor.updateRow([row])&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14182130860608019 jive_text_macro" jivemacro_uid="_14182130860608019"&gt;&lt;P&gt;cursor.updateRow(row)&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and your code should work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2014 12:04:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/problem-in-inserting-row-in-shape-file-using/m-p/483879#M16239</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2014-12-10T12:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in Inserting Row in shape file using Python,</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/problem-in-inserting-row-in-shape-file-using/m-p/483880#M16240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Jake, i was so much confused,&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/confused.png" /&gt;&amp;nbsp; but you solved my problem.&lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2014 17:35:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/problem-in-inserting-row-in-shape-file-using/m-p/483880#M16240</guid>
      <dc:creator>AhsanAbbas</dc:creator>
      <dc:date>2014-12-10T17:35:13Z</dc:date>
    </item>
  </channel>
</rss>

