I've been trying to use this code to add a field to, merge, and sort multiple feature classes:
import arcpy, os
arcpy.env.workspace = r'W:\S&P\s&p techs\Emily\TownshipsDissolved\FinalDissolved.gdb'
#Looping through dissolved feature classes, adding 'Name' field and writing
#feature class name in the added field.
fcs = arcpy.ListFeatureClasses()
for fc in fcs:
arcpy.AddField_management(fc, "Name", "TEXT", field_length = 50)
with arcpy.da.UpdateCursor(fc, "Name") as cursor:
for row in cursor:
row[0] = fc
cursor.updateRow(row)
#Merging the multiple feature classes into one named OSRS_ORN_NER.
mergeOutput = r'W:\S&P\s&p techs\Emily\TownshipsDissolved\FinalDissolved.gdb\OSRS_ORN_NER'
sortOutput = r'W:\S&P\s&p techs\Emily\TownshipsDissolved\FinalDissolved.gdb\OSRS_ORN_NER_new'
arcpy.Merge_management(fcs, mergeOutput)
#Sorting by HWY_NUM_PR and replacing OSRS_ORN_NER by the sorted feature class.
arcpy.Sort_management(mergeOutput, sortOutput, [["HWY_NUM_PR", "ASCENDING"]])
but when I run it I get an error that says this:
does anyone know what I'm doing wrong??