AnsweredAssumed Answered

da.SearchCursor() not honoring selected set in ArcGIS Pro

Question asked by jborgion Champion on Aug 22, 2018
Latest reply on Aug 22, 2018 by jborgion

(ArcGIS Pro 2.2)

 

In ArcMap 10.5.1 when I select a number of features and apply a search cursor to it, the cursor examines the selected features only but in ArcGIS Pro it does not:

 

#arcmap, python 2.x:

import arcpy
with arcpy.da.SearchCursor("National_Grid",'USNG') as cursor:
    for row in cursor:
        print row[0]
...        
12TVL320100
12TVL320120
12TVL340120
12TVL340140
12TVL360120
12TVL360140


#####################

#ArcGIS Pro python 3.x:

import arcpy
fc = r'C:\LAS_Data\NationalGrid\National_Grid.shp'
fields = 'USNG'
gridlist = []
with arcpy.da.SearchCursor(fc,fields)as cursor:
    for row in cursor:
        gridlist.append(row[0])

gridlist
['12TUK920880', '12TUK920900', '12TUK920920', '12TUK920940', '12TUK920960', '12TUK920980', '12TUK940840', '12TUK940860', '12TUK940880', '12TUK940900', '12TUK940920', '12TUK940940', '12TUK940960', '12TUK940980', '12TUK960840', '12TUK960860', '12TUK960880', '12TUK960900', '12TUK960920', '12TUK960940',etc,etc,etc....]

Bummer.

 

Is this a new known (intended) feature?  Is there a way to convince the search cursor to honor the selected set?

Outcomes