Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Add field: error in executing tool

$
0
0
I am trying to add a field to all layers with multiple GDB's. Am I unable to collect a list of values and run addField tool on them?

Code:

import arcpy
import os, math
from arcpy import env


in_workspace = r"F:/test/testRnd"
rndValue = "int(round(!ELEVATION!, -2))"
fcList = []
fieldName = "SL_ELEV"
for dirpath, dirnames, filenames in arcpy.da.Walk(in_workspace, datatype="FeatureClass",type="All"):
    for filename in filenames:
        fcList.append(os.path.join(dirpath, filename))

#Add new field
arcpy.AddField_management(fcList, fieldName, "SHORT", "", "", "", "", "NULLABLE")

Thanks

Viewing all articles
Browse latest Browse all 2485

Trending Articles