Hi Micah,
Here is the updated portion of the script. I am trying to figure out a solution to just return the selected records in the Dist_LL layer based on the number of selected records in fc.
for fc in fcs:
geometryType = arcpy.Describe(fc).shapeType
print geometryType
if geometryType == 'Point':
#Get feature class name
fcsname = os.path.basename(fc)
name = os.path.splitext(fcsname)
y = name[1].lstrip('.')
print y
#Get these fields from feature classes
fields = ["OID@", "LANDDISTRICT", "LANDLOT"]
for row in arcpy.da.SearchCursor(fc, fields):
if row[1] is None:
arcpy.MakeFeatureLayer_management(fc, 'fc_layer')
arcpy.SelectLayerByLocation_management('fc_layer', 'INTERSECT', 'DistLL_layer')
for DLrow in arcpy.da.SearchCursor('DistLL_layer', ["LAND_DIST", "LAND_LOT"]):
print DLrow
print row
elif row[2] is None:
print row
else:
continue
I am not sure if the problem lies with the way the search cursor is ran or if it was even set up to return the selected features. I will try to modify this to see if I can get the correct result to return, but I am not sure how to get there.
Also, I keep receiving this error message for some reason and I don't know how to offset this error. It occurs every time and I don't know if it is the way it is nested or if it is due to not being deleted. I will try a couple of things to see if I can correct this but this error is new to me. Any assistance on this would also be greatly appreciated.
Traceback (most recent call last):
File "U:\Models_Tools\Scripts related to Landlot and District\Populate Landlot and District.py", line 31, in <module>
arcpy.MakeFeatureLayer_management(fc, 'fc_layer')
File "C:\Program Files (x86)\ArcGIS\Desktop10.6\ArcPy\arcpy\management.py", line 6993, in MakeFeatureLayer
raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000725: Output Layer: Dataset fc_layer already exists.
Failed to execute (MakeFeatureLayer).
Thank you very much for your help Micah.
Robert