I'm attempting to perform what I thought would be a simple series of select by locations using arcpy -- e.g. create feature layers for each input feature and select feature and then complete the select by location.
boundary_file_list = arcpy.ListFeatureClasses()
for boundary_file in boundary_file_list:
arcpy.MakeFeatureLayer_management(boundary_file, "bnd_lyr")
arcpy.MakeFeatureLayer_management(copy_ft, "in_lyr")
arcpy.SelectLayerByLocation_management ("in_lyr", "INTERSECT", "bnd_lyr")
arcpy.CopyFeatures_management("in_lyr", output_ft)
But I get an error message on the second round of the processing, as the boundary feature layer already exists:ExecuteError: Failed to execute. Parameters are not valid.ERROR 000725: Output Layer: Dataset bnd_lyr already exists.Failed to execute (MakeFeatureLayer). Does that mean I have create a unique boundary layer name for each iteration of the series? Eg. "bnd_lyr" + str(x) , while x >= 0 and x< 10 ?Is there some other way to remove or delete the feature layer?Many thanks!