1

I am running python in the ArcGIS python window. ArcGIS shows error message when trying data merge from arcpy.

File "", line 1, in File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\management.py", line 3816, in Merge raise e ExecuteError: ERROR 000732:

import os
import arcpy
arcpy.env.workspace = "C:/the shapefile folder/"

path = os.listdir("C:/the shapefile folder/")#unzipped all shapefiles to this folder
shapefile = []
for i in path:
    suffix = ".shp";
    if i.endswith(suffix):#getting all files end with '.shp' to a new list
        shapefile.append(i)
arcpy.Merge_management(shapefile,"C:/output folder")

I don't see where the problem is. Please help diagnose. Thanks!

  • Ok, this may be an issue with your copy/paste of the code, but you've indented the line suffix = ".shp"; right? Otherwise that would potentially be causing some of the issues because wouldn't it would be escaping the for loop after the first line. – John Apr 23 '14 at 19:04
  • Yes, it is intended. My mistake pasting it without doublecheking. – WHZW Apr 23 '14 at 19:07
  • The other thing I'd ask then is, do you have any spaces in the names of your shapefiles? If so, try renaming them with underscore replacing the space and then try running this. Not saying it'll solve it for sure, I just know this has previously be an issue for me on occasion, especially when working with shapefiles rather than GDB feature classes. Also, you could see if it is a shapefile only problem by first importing all the shp files into a GDB and then running it against the FC's and see if same error or not... just some thoughts in case you don't get better answers. – John Apr 23 '14 at 19:13
  • my shapefile list looks like this: ['tl_2013_01_tract.shp', 'tl_2013_02_tract.shp', 'tl_2013_04_tract.shp', 'tl_2013_05_tract.shp']. I think it is legit in terms of format. – WHZW Apr 23 '14 at 19:16
  • Ok, just to test it, you might also want to try changing "the shapefile folder" to "the_shapefile_folder" (both in the actual folder directory and in both places in the script). And try changing "output folder" to "output_folder". Again, can't guarantee, but if in doubt, try the little simple known issues first. – John Apr 23 '14 at 19:22
1

you need to provide an output feature class (e.g. "C:/outputfolder/newfc.shp" or "C:/outputfolder/geodatabase.gdb/newfc", if geodatabase.gdb already exists) and not an output folder (C:/outputfolder) for the merge tool.

Also check that your shapefile have a defined CRS, but the error probably comes from the above output.

  • I am not sure how to set the output feature class. Can you elaborate a bit based on my learning source(help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//…)? Thank you. – WHZW Apr 23 '14 at 20:04
  • 1
    see my updated answer. Basically, this is like the difference between a directory and a file : here you want to create a new "file", but you specified a directory (or maybe not, but you wrote "outputfolder" – radouxju Apr 23 '14 at 21:41

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.