AnsweredAssumed Answered

I need to rename a list of feature classes (each one has only one feature) based on attribute data, i face an error says ExecuteError: ERROR 000840: The value is not a Data Element.  for last line in this code... please advice

Question asked by mohamedabdelhamid on Mar 12, 2015
Latest reply on Mar 25, 2015 by Ahmed.ElSisiesrinea-esridist

import arcpy

from arcpy import env

 

 

# Set the workspace for ListFeatureClasses

env.workspace = r"C:\Users\mohamed.abdelhamid\Desktop\Python\test\rename_test.gdb"

fcs = arcpy.ListFeatureClasses()

 

 

# Get the subdistric name from attribute

for itmes in fcs:

    field1  = "DIS_ARB_NA"

    field2 = "SDIS_ARB_N"

    cursor = arcpy.SearchCursor(itmes)

    for row in cursor:

        disname = row.getValue(field1)

        subname = row.getValue(field2)

        arcpy.Rename_management(in_data=itmes,out_data=disname + "_" + subname,data_type="FeatureClass")

Outcomes