<?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 with UpdateCursor() in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/problem-with-updatecursor/m-p/332644#M25918</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;In a cursor, the feature class and where clause need to be defined as separate variables. You currently have them in a single variable separated by a comma, which in fact creates a Python tuple. &lt;BR /&gt;&lt;BR /&gt;Try using this format instead:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fc = testConnection + "\\" + testTable
whereClause = "\"LAYER_NAME\" = '" + layerName + "'"
c4 = gp.updateCursor(fc, whereClause)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I changed it to the above but now I am getting this error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;RuntimeError: ERROR 999999: Error executing function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the original script worked in 9.3 but now I am running the same code in 10...could it be an issue with that?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Igor&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 15:45:35 GMT</pubDate>
    <dc:creator>IgorBalotsky1</dc:creator>
    <dc:date>2021-12-11T15:45:35Z</dc:date>
    <item>
      <title>Problem with UpdateCursor()</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-updatecursor/m-p/332642#M25916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am writing a simple script to test the updatecursor() function, and here is the code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import sys, string, os, time, math, arcgisscripting&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;from datetime import datetime, date&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;gp = arcgisscripting.create()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.overwriteoutput = 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;testConnection = "Database Connections\\testConn.sde"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;testTable = "sdeinstance.sde.UPDATE_TABLE"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;layerName = "TEST_LAYER"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;print "TEST0"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fc = testConnection + "\\" + testTable, "\"LAYER_NAME\" = '" + layerName + "'"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;c4 = gp.updateCursor(fc)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print "TEST1"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;r4 = c4.next()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is that I keep getting an IO error that the reference to fc does not exist. I have triple checked the names and everything works fine. Maybe it's something simple; any ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Igor&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Nov 2012 16:35:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-updatecursor/m-p/332642#M25916</guid>
      <dc:creator>IgorBalotsky1</dc:creator>
      <dc:date>2012-11-05T16:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with UpdateCursor()</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-updatecursor/m-p/332643#M25917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In a cursor, the feature class and where clause need to be defined as separate variables. You currently have them in a single variable separated by a comma, which in fact creates a Python tuple. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Try using this format instead:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;fc = testConnection + "\\" + testTable whereClause = "\"LAYER_NAME\" = '" + layerName + "'" c4 = gp.updateCursor(fc, whereClause)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Nov 2012 16:56:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-updatecursor/m-p/332643#M25917</guid>
      <dc:creator>BradPosthumus</dc:creator>
      <dc:date>2012-11-05T16:56:47Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with UpdateCursor()</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-updatecursor/m-p/332644#M25918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;In a cursor, the feature class and where clause need to be defined as separate variables. You currently have them in a single variable separated by a comma, which in fact creates a Python tuple. &lt;BR /&gt;&lt;BR /&gt;Try using this format instead:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fc = testConnection + "\\" + testTable
whereClause = "\"LAYER_NAME\" = '" + layerName + "'"
c4 = gp.updateCursor(fc, whereClause)&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I changed it to the above but now I am getting this error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;RuntimeError: ERROR 999999: Error executing function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the original script worked in 9.3 but now I am running the same code in 10...could it be an issue with that?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Igor&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:45:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-updatecursor/m-p/332644#M25918</guid>
      <dc:creator>IgorBalotsky1</dc:creator>
      <dc:date>2021-12-11T15:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with UpdateCursor()</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-updatecursor/m-p/332645#M25919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Actually I tried it with a different table and the function worked - so the issue is maybe with the table permissions.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Nov 2012 17:38:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-updatecursor/m-p/332645#M25919</guid>
      <dc:creator>IgorBalotsky1</dc:creator>
      <dc:date>2012-11-05T17:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with UpdateCursor()</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-updatecursor/m-p/332646#M25920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I found the issue! I created the table directly in SQL but when I created a similar table in ArcCatalog and referenced it in the script, everything worked fine. I guess it had something to do with creating the table directly in SQL.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Nov 2012 17:50:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-updatecursor/m-p/332646#M25920</guid>
      <dc:creator>IgorBalotsky1</dc:creator>
      <dc:date>2012-11-05T17:50:37Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with UpdateCursor()</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-updatecursor/m-p/332647#M25921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Glad to hear you found the problem! I likely wouldn't have. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Nov 2012 18:36:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-updatecursor/m-p/332647#M25921</guid>
      <dc:creator>BradPosthumus</dc:creator>
      <dc:date>2012-11-05T18:36:06Z</dc:date>
    </item>
  </channel>
</rss>

