<?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: Having problems with Runtime Error: Update Cursor in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670432#M51940</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Okay, I actually did manage to get it working on the shapefile I need by changing ".dbf" to ".shp". It's just strange that before the script was running fine with ".dbf" I never knew the shapefile could be corrupted by doing that - I'm learning, thanks you two! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will look at changing the search cursor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 02 Dec 2012 12:15:41 GMT</pubDate>
    <dc:creator>VictoriaPutinski</dc:creator>
    <dc:date>2012-12-02T12:15:41Z</dc:date>
    <item>
      <title>Having problems with Runtime Error: Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670428#M51936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am extremely new to Python, which will become evident in this post. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This script was working just fine before trying it on a new shapefile's attribute table. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;No column or row names were changed. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the code: &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy
import sys, os, time, copy

def POIequals(r1,r2):
&amp;nbsp;&amp;nbsp;&amp;nbsp; pnts=0
&amp;nbsp;&amp;nbsp;&amp;nbsp; #samePOI
&amp;nbsp;&amp;nbsp;&amp;nbsp; if r1.poi_id==r2.poi_id:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return True #If POI_ID is the same, it is assumed features are equal
&amp;nbsp;&amp;nbsp;&amp;nbsp; #sameAddress
&amp;nbsp;&amp;nbsp;&amp;nbsp; if r1.address==r2.address:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnts+=1
&amp;nbsp;&amp;nbsp;&amp;nbsp; #sameBank
&amp;nbsp;&amp;nbsp;&amp;nbsp; if r1.newname==r2.newname:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnts+=1
&amp;nbsp;&amp;nbsp;&amp;nbsp; #sameCity
&amp;nbsp;&amp;nbsp;&amp;nbsp; if r1.city==r2.city:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnts+=1
&amp;nbsp;&amp;nbsp;&amp;nbsp; #closeLoc
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (r1.x&amp;lt;=r2.x+0.0005 and r1.x&amp;gt;=r2.x-0.0005) and (r1.y&amp;lt;=r2.y+0.0005 and r1.y&amp;gt;=r2.y-0.0005):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pnts+=1
&amp;nbsp;&amp;nbsp;&amp;nbsp; if pnts &amp;gt;= 3: #three of the 5 tests above must pass for features to be considered equal
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return True
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return False
&amp;nbsp;&amp;nbsp;&amp;nbsp; 

print "Starting process..."
start=time.strftime("%a, %d %b %Y %H:%M:%S")
print start+"\n"

inFC="C:\\Users\\Toir\\Documents\\My Dropbox\\EPOIDuplicatesRemoved\\ALLFIN2002_2011\\AllFin2002_2011_Montreal.dbf"

rowsWrite = arcpy.UpdateCursor(inFC)
total=int(arcpy.GetCount_management(inFC).getOutput(0))

c=0
chold=0

for rowW in rowsWrite:
&amp;nbsp;&amp;nbsp;&amp;nbsp; #set variables for loop:
&amp;nbsp;&amp;nbsp;&amp;nbsp; poi=rowW.poi_id
&amp;nbsp;&amp;nbsp;&amp;nbsp; year=rowW.epoi_year
&amp;nbsp;&amp;nbsp;&amp;nbsp; gain=True
&amp;nbsp;&amp;nbsp;&amp;nbsp; loss=True
&amp;nbsp;&amp;nbsp;&amp;nbsp; #find if point is a gain or loss (or both):
&amp;nbsp;&amp;nbsp;&amp;nbsp; #where="[poi_id] = '"+poi+"'"
&amp;nbsp;&amp;nbsp;&amp;nbsp; rowsRead = arcpy.SearchCursor(inFC) #add "___,where)" to improve speed
&amp;nbsp;&amp;nbsp;&amp;nbsp; for rowR in rowsRead:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if POIequals(rowW,rowR):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if year-1==rowR.epoi_year:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gain=False
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if year+1==rowR.epoi_year:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; loss=False
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not loss and not gain:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break
&amp;nbsp;&amp;nbsp;&amp;nbsp; #set change variable:
&amp;nbsp;&amp;nbsp;&amp;nbsp; change=""
&amp;nbsp;&amp;nbsp;&amp;nbsp; if gain:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; change="Gain"
&amp;nbsp;&amp;nbsp;&amp;nbsp; if loss:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; change="Loss"
&amp;nbsp;&amp;nbsp;&amp;nbsp; if gain and loss:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; change="GainAndLoss"
&amp;nbsp;&amp;nbsp;&amp;nbsp; if not gain and not loss:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; change="None"
&amp;nbsp;&amp;nbsp;&amp;nbsp; rowW.change=change
&amp;nbsp;&amp;nbsp;&amp;nbsp; rowsWrite.updateRow(rowW)
&amp;nbsp;&amp;nbsp;&amp;nbsp; #end of loop tasks:
&amp;nbsp;&amp;nbsp;&amp;nbsp; del rowR, rowsRead
&amp;nbsp;&amp;nbsp;&amp;nbsp; if c==chold:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "&amp;nbsp; -&amp;gt;"+str(c)+" of "+str(total)+" features completed. ("+str(round((float(c)/float(total)*100.0),1))+"%)"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; chold+=100
&amp;nbsp;&amp;nbsp;&amp;nbsp; c+=1

#unlock and final message:
del rowW,rowsWrite
print "Complete!"
end=time.strftime("%a, %d %b %Y %H:%M:%S")
print "Started: "+start+"\nEnded:&amp;nbsp;&amp;nbsp; "+end&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the error I get: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Traceback (most recent call last):
&amp;nbsp; File "C:\Users\Toir\Documents\My Dropbox\EPOIDuplicatesRemoved\ALLFIN2002_2011\findLossAndGainWorkingBroadEquals_edit.py", line 33, in &amp;lt;module&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; rowsWrite = arcpy.UpdateCursor(inFC)
&amp;nbsp; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\__init__.py", line 825, in UpdateCursor
&amp;nbsp;&amp;nbsp;&amp;nbsp; return gp.updateCursor(*args)
&amp;nbsp; File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\_base.py", line 362, in updateCursor
&amp;nbsp;&amp;nbsp;&amp;nbsp; self._gp.UpdateCursor(*gp_fixargs(args)))
RuntimeError: ERROR 999999: Error executing function.&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help on this would be great, and ASAP please!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Dec 2012 20:25:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670428#M51936</guid>
      <dc:creator>VictoriaPutinski</dc:creator>
      <dc:date>2012-12-01T20:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Having problems with Runtime Error: Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670429#M51937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Your problem is at line 33 where the update cursor is being set on your input fc -- you said you wanted to make it run on a shapefile, so you should set it to &amp;lt;your shapefile name&amp;gt;.shp.&amp;nbsp; ...not the dbf as you have it set now.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, it wouldn't hurt to insert more error trapping, such as checking for existence of the input file so if it fails there you would know it, maybe something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
inFC="C:\\Users\\Toir\\Documents\\My Dropbox\\EPOIDuplicatesRemoved\\ALLFIN2002_2011\\AllFin2002_2011_Montreal.shp"
if arcpy.Exists(inFC):
&amp;nbsp;&amp;nbsp;&amp;nbsp; rowsWrite = arcpy.UpdateCursor(inFC)
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print 'Could not set update cursor.'
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:18:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670429#M51937</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2021-12-12T04:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Having problems with Runtime Error: Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670430#M51938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for your quick reply!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I should have made it clearer before - I am working on a shapefile, but the script is searching through the shapefile's database file. The script was always working fine before. Also the file does exist, so I'm really not too sure how to fix this. I just tried both of your suggestions and nothing worked... any more thoughts? Thanks so much!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Dec 2012 11:15:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670430#M51938</guid>
      <dc:creator>VictoriaPutinski</dc:creator>
      <dc:date>2012-12-02T11:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: Having problems with Runtime Error: Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670431#M51939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;While it is possible to access your shapefile's dbf separately, it is not advisable and you may corrupt your shapefile.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You should be using the cursor on the .shp and arcpy will understand to use the component dbf attribute table.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you must have a separate stand-alone dbf table (it doesn't sound it is necessary in your case) then you can export or copy out a separate dbf table by a different name and access it with the cursor, but you will no longer have geometry access (and of course the table will no longer be associated with the shp).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm pretty certain this is your problem.&amp;nbsp; At any rate, the error states you cannot instantiate the cursor object.&amp;nbsp; Probably not it, but also check for schema locks.&amp;nbsp; Are you having any other errors?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT:&amp;nbsp; Also, it doesn't make sense to have both an update cursor and search cursor on the same table...I see further into your code this is attempted.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Dec 2012 11:59:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670431#M51939</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2012-12-02T11:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Having problems with Runtime Error: Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670432#M51940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Okay, I actually did manage to get it working on the shapefile I need by changing ".dbf" to ".shp". It's just strange that before the script was running fine with ".dbf" I never knew the shapefile could be corrupted by doing that - I'm learning, thanks you two! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I will look at changing the search cursor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Dec 2012 12:15:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670432#M51940</guid>
      <dc:creator>VictoriaPutinski</dc:creator>
      <dc:date>2012-12-02T12:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Having problems with Runtime Error: Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670433#M51941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, well, it can be a little confusing - think of it intuitively:&amp;nbsp; why do you think the component files of a shapefile are always accessed by ArcGIS as a 'set'?...and that generally the only time a separate dbf is recognized by ArcGIS is when it is named differently or exported from a Table View (as from the attribute table window, separately named of course)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's another tip:&amp;nbsp; If you need to conditionally search for values from your table while also updating it, you should probably consider reading your shapefile into a python dictionary.&amp;nbsp; This essentially loads data into memory where you can search it repeatedly as you're iterating over rows and writing your final updates row by row.&amp;nbsp; Will likely result in a significant performance boost too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that helps, and if you would please mark this post as 'answered'.&amp;nbsp; Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Dec 2012 12:27:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670433#M51941</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2012-12-02T12:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: Having problems with Runtime Error: Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670434#M51942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Two last things: How would I read the shapefile into python as a dictionary? &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And also (and I feel really dumb asking this because it's probably really obvious but I can't find it) how do you mark a thread as answered? I'm really new to this forum.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Dec 2012 12:33:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670434#M51942</guid>
      <dc:creator>VictoriaPutinski</dc:creator>
      <dc:date>2012-12-02T12:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Having problems with Runtime Error: Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670435#M51943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If your code is performing adequately enough for your purposes at the present time, I wouldn't modify it any more.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Not to discourage you (not at all), but I'd pick a more opportune time to completely rewrite the code.&amp;nbsp; There are plenty of good resources to get you started on using python dictionaries and I can post a few links if you like...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As for marking these posts, either answered or for points, there is a 'toggle button' with 2 arrows in the right margin.&amp;nbsp; Experiment with that, you'll get it.&amp;nbsp; There is a pic at the top of the page here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/"&gt;http://forums.arcgis.com/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...or, more explanation here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/forums-mvp/"&gt;http://resources.arcgis.com/en/help/forums-mvp/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Dec 2012 12:46:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670435#M51943</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2012-12-02T12:46:22Z</dc:date>
    </item>
    <item>
      <title>Re: Having problems with Runtime Error: Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670436#M51944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just for starters, it's interesting to note arcpy has several functions that return dictionaries.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Basically it's a list of key/value pairs -- extremely useful, because you can 'look up' values by a 'key' - think of the key almost as a 'field' in a table (except now we're working with a different data structure than the ArcGIS tables you are already familiar with).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The following returns a dictionary of your ArcGIS install info - see the example on how to read the vals contained:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;GetInstallInfo&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Resource Center » Professional Library » Geoprocessing » The ArcPy site package » Functions » Licensing and installation&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v0000003s000000"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v0000003s000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;EDIT:&amp;nbsp; I didn't see anything in the ArcGIS webhelp (there may be something in the ArcGIS blog, maybe to do with multiprocessing, etc.) or I don't at the moment know of any examples writing a dictionary, but I thought it would only be fair to include both reading/writing, so see this on gis.stackexchange.com:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How are people using Python data structures and classes in Arcpy?&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://gis.stackexchange.com/questions/34443/how-are-people-using-python-data-structures-and-classes-in-arcpy"&gt;http://gis.stackexchange.com/questions/34443/how-are-people-using-python-data-structures-and-classes-in-arcpy&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Dec 2012 13:04:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670436#M51944</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2012-12-02T13:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Having problems with Runtime Error: Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670437#M51945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'll post a simple example of straight joining a list of fields. It assumes the key field is the same name in both tables.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy

key_field = # common field to join on
field_list = [# list of field names to join]

update_lyr = # table to update, usually I limit this to the key_field only
avi_view = # table to join, usually I create this with a field map limited to my field_list but it isn't necessary

# This creates a list of input fields storing the name, type and length
avi_type_dict = dict((f.name, (f.type, f.length))
&amp;nbsp;&amp;nbsp;&amp;nbsp; for f in arcpy.ListFields(avi_view))

# this adds all the fields in your field list and references the dict of types, lengths to make them the same
for f in avi_field_list:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; forest_lyr, f, avi_type_dict&lt;F&gt;[0], field_length=avi_type_dict&lt;F&gt;[1])

# this loads all of the input rows into a dictionary
view_dict = {}
for row in arcpy.SearchCursor(avi_view):
&amp;nbsp;&amp;nbsp;&amp;nbsp; view_dict[row.getValue(key_field)] = dict(
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (f, row.getValue(f)) for f in field_list)

# this updates the target table
updateCursor = arcpy.UpdateCursor(update_lyr)
for row in updateCursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp; for f in field_list:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; updateVal = view_dict[row.getValue(key_field)]&lt;F&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row.setValue(f, updateVal)
&amp;nbsp;&amp;nbsp;&amp;nbsp; updateCursor.updateRow(row)&lt;/F&gt;&lt;/F&gt;&lt;/F&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:18:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670437#M51945</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-12T04:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Having problems with Runtime Error: Update Cursor</title>
      <link>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670438#M51946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ah, thanks Mathew, good to practice with!&amp;nbsp; Hope Victoria sees this one.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Dec 2012 17:03:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/having-problems-with-runtime-error-update-cursor/m-p/670438#M51946</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2012-12-03T17:03:03Z</dc:date>
    </item>
  </channel>
</rss>

