EDIT: I figured it out.. apparently if there is data in the TOC it gets confused. By deleting the data from the TOC on each run through the loop i was able to get the append operation to work... odd problem with a simple solution. Thanks for taking a look, here is the updated main for loop for mdb in mdbList: env.workspace = destSpace destList = arcpy.ListFeatureClasses() print "Dest Length = " + str(len(destList)) tempSpace = mxdPath.replace("SetupRUN.mxd", mdb) env.workspace = tempSpace fcList = arcpy.ListFeatureClasses() print "Destination MDB - " +str(destSpace) print "Source MDB - " + str(tempSpace) if len(destList) == 0: for fc in fcList: arcpy.Copy_management(fc, destSpace + "\\"+fc) print "copied FC - " +str(fc) elif len(destList) >=1: for fc in fcList: for dest in destList: if fc == dest: print "Source FC - "+ fc print "Destination FC - "+ dest print "Destination location - "+ destSpace + "\\" + fc arcpy.Append_management([fc], destSpace + "\\" + fc, "NO_TEST" , "" , "") for df in arcpy.mapping.ListDataFrames(mxd): for lyr in arcpy.mapping.ListLayers(mxd,"",df): arcpy.mapping.RemoveLayer(df, lyr)
Hi. I am working on a bit of python to merge many MDB worth of FC into a new freshly created MDB. For the most part they are the same. the error is ERROR 000572: The output cannot be the same as input. Failed to execute (Append)I have been trying to reconcile this error for the better part of a few days with no luck. I am almost positive that the source and destination are different things. OUTPUT WINDOW::Destination MDB - C:\Users\atimpson\Desktop\MDB Combiner\Combined.mdbSource MDB - C:\Users\atimpson\Desktop\MDB Combiner\20121008_Group_B_formatted.mdbRuntime error <class 'arcgisscripting.ExecuteError'>: ERROR 000572: The output cannot be the same as input. Failed to execute (Append). import os import arcpy import time from arcpy import env mdbList=[] sizeList = [] mxd = arcpy.mapping.MapDocument("CURRENT") mxdPath = mxd.filePath workSpace = mxdPath.replace("\SetupRUN.mxd", "") print workSpace env.workspace = workSpace dirlist=os.listdir(workSpace) for item in dirlist: if item.lower().endswith("mdb"): print item mdbList.append(item) arcpy.CreatePersonalGDB_management(workSpace, "Combined.mdb") destSpace = mxdPath.replace("SetupRUN.mxd", "Combined.mdb") env.workspace = destSpace destList = arcpy.ListFeatureClasses() print "Destination Contents = " + str(destList) for mdb in mdbList: env.workspace = destSpace destList = arcpy.ListFeatureClasses() print "Dest Length = " + str(len(destList)) tempSpace = mxdPath.replace("SetupRUN.mxd", mdb) print "Database = " + tempSpace env.workspace = tempSpace fcList = arcpy.ListFeatureClasses() if len(destList) == 0: for fc in fcList: arcpy.Copy_management(fc, destSpace + "\\"+fc) print "copied FC - " +str(fc) elif len(destList) >=1: for fc in fcList: for dest in destList: if fc == dest: arcpy.Append_management([fc], destSpace + "\\" + fc, "NO_TEST" , "" , "") print mdb size = len(fcList) sizeList.append(size) print "FeatureClasses = " +str(fcList) print "FC count = " + str(size) print "" print sizeList print "Number of Databases to be Merged = " +str(len(sizeList))