Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Can someone explain why you need to delete the cursor objects and the iterator when you use for example:

arcpy.UpdateCursor(blah)

I've checked the esri docs and there doesn't seem to be an explanation there, but the object is shown to be deleted at the end of both example scripts.

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

You need to delete the object in order to release any locks the UpdateCursor has taken out.

share|improve this answer
    
Yeah I just noticed that in the commented code. Cheers. –  HowdyDoody Aug 6 '13 at 1:01
3  
For those that are interested if you use the code: "with arcpy.UpdateCursor(blah) as cursor" this will 'guarantee close and release of database locks and reset iteration' as stipulated in the relevant ESRI documentation. –  HowdyDoody Aug 6 '13 at 4:15
add comment

Your Answer

 
discard

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.