1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Weird cursor issue

Discussion in 'Geography' started by gwydion93, Oct 8, 2018.

  1. gwydion93

    gwydion93 Guest

    Lets say I have a temp layer made out of selected items from another layer and I am trying to look through 2 attributes in that layer with searchCursor:

    union_test = "C:/Workspace/Sandbox/MapChangeProject/intersects.gdb/footprint_cslf_union_10418"
    selects = arcpy.SelectLayerByAttribute_management(union_test, "NEW_SELECTION", "FID_master_merge_footprints_20181004 <> -1 and FID_cslf_20181004 <> -1 and DFIRM_ID like \''+ {} +'%\'".format(fip))
    selector = arcpy.MakeFeatureLayer_management(selects, 'selects_lyr')

    I've noticed in testing that if I run the following in my terminal once, it works fine, and prints as expected. But if I try to run it again, nothing prints. Why would this be happening? Is it due to the selector layer just being temporary or something else. For runtime sake, I was trying to avoid using arcpy.CopyFeatures_management to make a physical feature layer that I would need to store in a .gdb somewhere.

    cursor = arcpy.da.SearchCursor(selector,['Pre_Zone', 'NEW_ZONE'])
    for row in cursor:
    pzone_value = row[0]
    nzone_value = row[1]
    test = placer(pzone_value, nzone_value)

    Login To add answer/comment

Share This Page