AnsweredAssumed Answered

Add Field decided to add an underscore to the field name

Question asked by ben_sloboda on Jun 5, 2012
Latest reply on Jun 6, 2012 by kenbuja
I created a script to build a template geodatabase.  The code creates a geodatabase, adds a few domains, creates a feature class, adds some fields to the feature class and sets their domains, and finally sets all the default values for the fields.

The problem is this one line of code:

arcpy.AddField_management(NewTrees, "Public", "TEXT", "", "", "", "", "", "REQUIRED", "Public")


Somehow, this code creates a field called "Public_".  Note the added underscore.  (NewTrees is just a variable referencing the newly created feature class.)

There are no other fields in the feature class before this line (as it was just created). 

Does anyone know why Python would add an underscore to a field name!?

-Ben S.

Outcomes