Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a script to update a field in one feature class from a selected record in another feature class. This is done through looping through records in one feature class selecting appropriate the record in the other then reading the ID and updating the first feature class. I ran some tests on small subsets of the data and it worked fine. When i run across the full data set the MXD crashes (there are 30,000+/- records in the first feature class and 80,000 in the second). I am assuming this has something to do with memory, but I am not sure. Any help in solving this issue or improving the efficiency of the script (included below) is much appreciated. thanks.

import arcpy
cur = arcpy.UpdateCursor("layer_1")

for i in cur:
    if st[-4:] == 'PKWY' or st[-4:] == 'EXPY':
        qry = "Street = '"+st+"'"
        for row in cur2:
            i.T_SegmentID = seg
share|improve this question
Make sure you are deleting your cursor objects at the end of the script: del cur,cur2,i,row – Jason May 13 '13 at 17:45
What error message (if any) are you getting? Also check your string manipulation logic, that will never evaluate to true. – blah238 May 13 '13 at 19:14
ah, thanks for cathing that. – Hotpepper May 14 '13 at 15:08
up vote 5 down vote accepted

You may have better luck if you delete your cursor cur2 at the end of the else block. The lack of cleanup would explain the ArcMap crash, as memory loads up with abandoned cursor objects.

for row in cur2:
    i.T_SegmentID = seg
del row, cur2

As for ideas to help performance: have you tried the Join By Location on the two layers? If that connects the features for you, you could just do a join to the results and use the Join Fields tool to copy over attributes.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.