In a script I have designed a function that is used multiple times on different search cursors to search through a whole table.

Function variables:

p - a list of points: actually a list of two-element lists with point coordinates, e.g. [[4710000.0, 3300000.0], [4715000.0, 3305000.0], [4710000.0, 3310000.0], [4705000.0, 3305000.0], [4715000.0, 3300000.0], [4715000.0, 3310000.0], [4705000.0, 3310000.0], [4705000.0, 3300000.0]]

c - a SearchCursor on a table with point coordinates

The function is supposed to search through the table with a cursor and return a list of points from the table that are also on the "p" list.

def ptsrch(p,c):
    list = []
    for i in c:
        currpt = [i.getValue("X_GRID"),i.getValue("Y_GRID")]
        if currpt in p:
    return list

It works fine on the first use of each SearchCursor. Even though at the end of the function the cursor is supposed to reset, it doesn't.

In ArcGIS 10 Desktop help reset() is listed as a method: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000v00000068000000

I found a worrying post from 2008 on ESRI Forums: http://forums.esri.com/Thread.asp?c=93&f=1729&t=250536

in which it is stated that "As far as I know, the Reset Method has never worked. I was told 2-3 years ago that it would be operational in a "future release". Apparently that time hasn't come yet!"

That one though refers to ArcGIS 9.3 or earlier.

I have also found a blog post: https://omniolocalia.wordpress.com/tag/arcpy-da-searchcursor/ which praises the possibility to reset cursors in ArcGIS 10.1, mentioning that it was previously impossible.

So, has anyone encountered a similar problem?

Instead of a SearchCursor I can of course load all tables to Python lists and keep them in memory, though I'm afraid of a memory overload - the total number of rows in these tables will be almost 400000 (right now I'm testing on a small chunk of data, so the total number of rows is 500).

  • It does not work for me after first iteration either. I do use it, since ESRI recommneds it, but I always thought, that it is not working as expected. You can always set arcpy.searchCursor once again after first iteration, it does work then.
    – Tomek
    Commented Apr 17, 2014 at 11:18

1 Answer 1


If it were me I would pass into your function the Featureclass and create and destroy the search cursor within the function. I would not pass a cursor as a parameter into it. If you use the new da module you can use the with statement to ensure that it is released releasing memory rather than have some object floating around in memory locking the data source.

  • 1
    And that is what I just did. Still curious whether the reset actually worked for someone. As for the da module it's available in 10.1 and I'm still on 10.0.
    – Mireslav
    Commented Apr 17, 2014 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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