Failed to execute Merge

3206
2
06-26-2013 02:34 AM
DmitryBubnenkov
New Contributor
I wrote next script:

import arcpy
import glob

arcpy.env.workspace = "C:\\code\\polygons\\"

files = glob.glob("C:\\code\\polygons\\*.shp")
outlocation = "C:\\code\\single\\"
emptyshp = "1.shp"

arcpy.Merge_management(files, "C:\\code\\single\\1.shp")


But when I trying to run it I get error:
C:\code>join_polygons.py
Traceback (most recent call last):
  File "C:\code\join_polygons.py", line 14, in <module>
    arcpy.Merge_management(files, "C:\\code\\single\\1.shp")
  File "C:\Program Files\ArcGIS\Desktop10.1\arcpy\arcpy\management.py", line 378
8, in Merge raise e
arcgisscripting.ExecuteError: ERROR 001156: Failed on input OID 0, could not write value '"BKA_03595_03586_46_3NP2_17_T_PSS1_170915_290313.img"' to output field cDataFileNFailed to execute (Merge).


And at output I folder I got 1.shp file with few merged futures. But file looked like corrupted.
Tags (2)
0 Kudos
2 Replies
markdenil
Occasional Contributor III
It sounds like a field mapping issue.
Try running the same merge in the interactive tool.
0 Kudos
RhettZufelt
MVP Frequent Contributor
sounds like the field "cDataFileNFailed" is either not a text field, or is not large enough to hold that string.

R_
0 Kudos