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

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


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
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. – TheLastGIS Aug 6 '13 at 1:01
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. – TheLastGIS Aug 6 '13 at 4:15

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.