Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

Using Alter Field tool of ArcGIS for Desktop on shapefile?

$
0
0

According the ArcGIS 10.2.2 help this should work:

inZoneData = sys.argv[1] # This is a shapefile
fieldList = arcpy.ListFields(inZoneData) 
    for field in fieldList:
        if field.name.upper() == 'STATUS':  # rename status
            arcpy.AlterField_management(inZoneData, field, 'status')

but it does not. What I get is invalid parameter. If I try this:

for field in arcpy.ListFields(inZoneData):
    if field.name() == 'STATUS':  # rename status
        arcpy.AlterField_management(inZoneData, 'STATUS', 'status')

I get invalid unicode error. I understand that error at least.

Can anyone shine some light on how AlterField actually works? I’ve tried several other things but cannot get this tool working. Is it a shapefile bug?


Viewing all articles
Browse latest Browse all 767

Trending Articles