I'm doing a script in ArcGIS I'm new to this. I have to append some field from a table to another, I did this script in Python but I have a problem when it want make the Mapping field with a field of type shape shape I mean = point, line, polygon ..

The error that I get is this one:

FieldMap: Error in adding input field to field map
Failed to execute (script).

My code is:

# import system modules
import arcpy, os
from arcpy import env

# get parameters
tabellaInput = arcpy.GetParameterAsText(0)

tabellaOutput = arcpy.GetParameterAsText(1)
# Set local variables
fieldMappings = arcpy.FieldMappings()
# add the table to field mapping

fieldnames = [f.name for f in arcpy.ListFields(tabellaInput)]
fieldnamesOut = [f.name for f in arcpy.ListFields(tabellaOutput)]

for elem in fieldnames:

if str(elem) not in fieldnamesOut:

#creat a field map for each field.
fldMap = arcpy.FieldMap()
fldMap.addInputField(tabellaInput,elem) # deve aggiugere questo field

# Set name of new output field
namefield = fldMap.outputField
namefield.name = elem
fldMap.outputField = namefield
# Add output field to field mappings object

schemaType = "NO_TEST"
subtype = ""


    # Process: Append the feature classes into   feature class
    arcpy.Append_management(tabellaInput, tabellaOutput, schemaType, fieldMappings, subtype)


    # If an error occurred while running a tool print the messages
    print arcpy.GetMessages()

it does stop inside the


when come a field of type shape

in fact, if I add inside the


the following line of code:

 if elem == 'Shape':

it works fine... this is pretty strange. Another thing is this, I have more fields in the input table then the target table. So why in the target don't I see all the fields of the input table?

Should I do a merge and not the append?


It's a feature not a bug. Seems that you do not need to add the SHAPE field to mapping, it will always be included and remain in the feature class. You can't seem to rename it either.


There is a very similar problem described and resolved in the ArcGIS Discussion Forums.

The solution seems to have been to use Add and Calculate Field to make sure that the input fields on all input tables are absolutely identical.

  • fields are equal thx for reply i trying – user9143 Jul 27 '12 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy