Select to view content in your preferred language

arcpy.AlterField() Error 99999 - fail to rename all fields with their alias?

425
3
Jump to solution
10-19-2022 05:17 AM
JohannesBierer
Regular Contributor

Hello,

I try to rename the fields of a feature class with their alias name, but I get an error message ERROR 99999.

I use notebook in ArcGIS PRo 2.9.3

Any ideas why?

 

inFc = "A4_Moorkulisse_2022"
fields = arcpy.ListFields(inFc)

for f in fields:
   
    print (f.name + " - " + f.aliasName)
    
    if f.aliasName in ("OBJECTID", "SHAPE"):
        
        continue
    
    else:
        arcpy.management.AlterField(inFc, f.name, f.aliasName, f.aliasName)

 

print output:

A4_Moorkulisse_2022.OBJECTID - OBJECTID

A4_Moorkulisse_2022.SHAPE - SHAPE

A4_Moorkulisse_2022.A3_Moorkulisse_2022_A2_Moorkulisse_2022_A1_Moorkulisse_2022_SP_R - Ref_Prozent

ExecuteError: ERROR 999999: Beim Werkzeug ist ein unerwarteter Fehler aufgetreten. Wenden Sie sich an den technischen Support von Esri (http://esriurl.com/support), und ziehen Sie die Fehlerhilfe zu Rate, die Informationen zu möglichen Lösungen oder Problemumgehungen enthält.
Fehler beim Ausführen von (AlterField).
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

You can't have spaces or dashes in the field name.

 legal field names 

View solution in original post

3 Replies
by Anonymous User
Not applicable

You can't have spaces or dashes in the field name.

 legal field names 

JohannesBierer
Regular Contributor

Ah Ok, thank you for your answer.

But it wasn't me who puts points in the field name, it is caused throught several arcpy.managment.AddJoin and then copy features processes .... so I don't know how to avoid the points?

0 Kudos
JohannesBierer
Regular Contributor

If I use this it seems to work, convert to string:

arcpy.management.AlterField(inFc, str(f.name), str(f.aliasName), str(f.aliasName))

 Thank you JeffK for the hint with the legal field names ...

0 Kudos