I'm trying to do a spatial join between sevaral feature classes as join features and one feature class as the target feature. I have written a python script for this but I get an error when I execute it.
arcpy.env.workspace = 'C:\Lab_5\Lab_5\AAB_gdb\AAB.gdb'
#This is to check if these are the feature classes that I want to use
defor_years = arcpy.ListFeatureClasses("def*")
for i in defor_years:
#This is to create the output name for each spatial join
output = 'C:\Lab_5\Lab_5\scratch_gdb\scratch.gdb\spatialjoin_'
for i in range(0,len(defor_years)):
year = defor_years[i]
name = output + str(year)
join_features = name
#Setting the variable for the target features
target_features = 'C:\Lab_5\Lab_5\AAB_gdb\AAB.gdb\commune'
When I execute it, I get this.
I guess it's not taking each output of the for loop, making that the final spatial join failed. Can anybody help me with this? Thank youuu!!!!.