I need to merge several shapefiles. All of them has the same attribute/field structure, but the width is not the same for the attributes with the same name. I tried to use Fieldmappings to set a wide enough destination field. But is not working. It doesn't create a long (50 characters) enough, so the error persistes. Error: Error 001156: Failed on input 26788, could not write value 'looong value here'. I know that the long strings are the problem. I've erased that polygon ID, and the error is gone. However, I need to have this process automated, solving it manually is not the solution. What is wrong with my code/Fieldmappings?
folder_combined_rasters = r"C:\Projects\Soils\FECv3Out.gdb"
MapSeries = []
# loading all feature classes into shapefiles memory list
arcpy.env.workspace = folder_combined_rasters
shapefiles = arcpy.ListFeatureClasses()
shapefiles.sort()
# Adding only the shapefiles that ends in 'Series' into MapSeries
for j,county in enumerate(shapefiles):
if county[3:] == 'Series':
MapSeries.append(county)
# defining fieldmaps
fldmps = arcpy.FieldMappings()
fm_series = arcpy.FieldMap()
# Adding only the needed fields to the fieldmap output
for field in arcpy.ListFields("SA_Series"):
field.lenght = 60
fm_series.addInputField(fm_series, field.name)
fldmps.addFieldMap(fm_series)
seriename = "Mine_Series"
arcpy.Merge_management(MapSeries, seriename , fldmps)