<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Append error in script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/append-error-in-script/m-p/641594#M50001</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try using the described name instead of the list object for the output fc name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for fc in fcList:

&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(fc)
&amp;nbsp;&amp;nbsp;&amp;nbsp; fcOut = os.path.join(destSpace, desc.name)

 for dest in destList:
&amp;nbsp; if fc == dest:
&amp;nbsp;&amp;nbsp; arcpy.Append_management([fc], fcOut, "NO_TEST" , "" , "")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 03:16:01 GMT</pubDate>
    <dc:creator>MathewCoyle</dc:creator>
    <dc:date>2021-12-12T03:16:01Z</dc:date>
    <item>
      <title>Append error in script</title>
      <link>https://community.esri.com/t5/python-questions/append-error-in-script/m-p/641593#M50000</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for taking a look, here is the updated&amp;nbsp; main for loop&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt; for mdb in mdbList:&amp;nbsp; env.workspace = destSpace&amp;nbsp; destList = arcpy.ListFeatureClasses()&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Dest Length = " + str(len(destList))&amp;nbsp; tempSpace = mxdPath.replace("SetupRUN.mxd", mdb)&amp;nbsp; env.workspace = tempSpace&amp;nbsp; fcList = arcpy.ListFeatureClasses()&amp;nbsp; print "Destination MDB - " +str(destSpace)&amp;nbsp; print "Source MDB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - " + str(tempSpace)&amp;nbsp;&amp;nbsp; if len(destList) == 0: &amp;nbsp; for fc in fcList: &amp;nbsp;&amp;nbsp; arcpy.Copy_management(fc, destSpace + "\\"+fc) &amp;nbsp;&amp;nbsp; print "copied FC - " +str(fc)&amp;nbsp;&amp;nbsp;&amp;nbsp; elif len(destList) &amp;gt;=1: &amp;nbsp; for fc in fcList: &amp;nbsp;&amp;nbsp; for dest in destList: &amp;nbsp;&amp;nbsp;&amp;nbsp; if fc == dest: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Source FC&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - "+ fc &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Destination FC - "+ dest &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Destination location - "+ destSpace + "\\" + fc &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Append_management([fc], destSpace + "\\" + fc, "NO_TEST" , "" , "")&amp;nbsp; for df in arcpy.mapping.ListDataFrames(mxd): &amp;nbsp; for lyr in arcpy.mapping.ListLayers(mxd,"",df): &amp;nbsp;&amp;nbsp; arcpy.mapping.RemoveLayer(df, lyr)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the error is ERROR 000572: The output cannot be the same as input. Failed to execute (Append)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;OUTPUT WINDOW::&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Destination MDB - C:\Users\atimpson\Desktop\MDB Combiner\Combined.mdb&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Source MDB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - C:\Users\atimpson\Desktop\MDB Combiner\20121008_Group_B_formatted.mdb&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error &amp;lt;class 'arcgisscripting.ExecuteError'&amp;gt;: ERROR 000572: The output cannot be the same as input. Failed to execute (Append). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import os import arcpy import time from arcpy import env&amp;nbsp;&amp;nbsp; mdbList=[] sizeList = [] mxd&amp;nbsp; = arcpy.mapping.MapDocument("CURRENT") mxdPath&amp;nbsp; = mxd.filePath workSpace = mxdPath.replace("\SetupRUN.mxd", "") print workSpace env.workspace = workSpace dirlist=os.listdir(workSpace)&amp;nbsp; for item in dirlist: &amp;nbsp;&amp;nbsp;&amp;nbsp; if item.lower().endswith("mdb"): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print item &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mdbList.append(item)&amp;nbsp; arcpy.CreatePersonalGDB_management(workSpace, "Combined.mdb") destSpace&amp;nbsp; = mxdPath.replace("SetupRUN.mxd", "Combined.mdb") env.workspace = destSpace destList = arcpy.ListFeatureClasses() print "Destination Contents = " + str(destList)&amp;nbsp; for mdb in mdbList:&amp;nbsp; env.workspace = destSpace&amp;nbsp; destList = arcpy.ListFeatureClasses()&amp;nbsp; print "Dest Length = " + str(len(destList))&amp;nbsp; tempSpace = mxdPath.replace("SetupRUN.mxd", mdb)&amp;nbsp; print "Database = " + tempSpace&amp;nbsp; env.workspace = tempSpace&amp;nbsp; fcList = arcpy.ListFeatureClasses()&amp;nbsp; if len(destList) == 0: &amp;nbsp; for fc in fcList: &amp;nbsp;&amp;nbsp; arcpy.Copy_management(fc, destSpace + "\\"+fc) &amp;nbsp;&amp;nbsp; print "copied FC - " +str(fc)&amp;nbsp;&amp;nbsp;&amp;nbsp; elif len(destList) &amp;gt;=1: &amp;nbsp; for fc in fcList: &amp;nbsp;&amp;nbsp; for dest in destList: &amp;nbsp;&amp;nbsp;&amp;nbsp; if fc == dest: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Append_management([fc], destSpace + "\\" + fc, "NO_TEST" , "" , "")&amp;nbsp;&amp;nbsp;&amp;nbsp; print mdb&amp;nbsp; size = len(fcList)&amp;nbsp; sizeList.append(size)&amp;nbsp; print "FeatureClasses = " +str(fcList)&amp;nbsp; print "FC count = " + str(size)&amp;nbsp; print "" print sizeList print "Number of Databases to be Merged = " +str(len(sizeList))&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Oct 2012 18:59:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/append-error-in-script/m-p/641593#M50000</guid>
      <dc:creator>AnthonyTimpson2</dc:creator>
      <dc:date>2012-10-31T18:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: Append error in script</title>
      <link>https://community.esri.com/t5/python-questions/append-error-in-script/m-p/641594#M50001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try using the described name instead of the list object for the output fc name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for fc in fcList:

&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(fc)
&amp;nbsp;&amp;nbsp;&amp;nbsp; fcOut = os.path.join(destSpace, desc.name)

 for dest in destList:
&amp;nbsp; if fc == dest:
&amp;nbsp;&amp;nbsp; arcpy.Append_management([fc], fcOut, "NO_TEST" , "" , "")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:16:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/append-error-in-script/m-p/641594#M50001</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2021-12-12T03:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Append error in script</title>
      <link>https://community.esri.com/t5/python-questions/append-error-in-script/m-p/641595#M50002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;fortunately the changes were accepted, unfortunately they brought about the same error&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error &amp;lt;class 'arcgisscripting.ExecuteError'&amp;gt;: ERROR 000572: The output cannot be the same as input. Failed to execute (Append).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am now printing out what should be appending to what and where.. everything seems ok.. this problem is really confounding. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;OUTPUT::&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Destination MDB - C:\Users\atimpson\Desktop\MDB Combiner\Combined.mdb&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Source MDB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - C:\Users\atimpson\Desktop\MDB Combiner\20121008_Group_B_formatted.mdb&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Source FC&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - main&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Destination FC - main&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Destination location - C:\Users\atimpson\Desktop\MDB Combiner\Combined.mdb\main&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Runtime error &amp;lt;class 'arcgisscripting.ExecuteError'&amp;gt;: ERROR 000572: The output cannot be the same as input. Failed to execute (Append). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import os
import arcpy
import time
from arcpy import env


mdbList=[]
sizeList = []
mxd&amp;nbsp; = arcpy.mapping.MapDocument("CURRENT")
mxdPath&amp;nbsp; = mxd.filePath
workSpace = mxdPath.replace("\SetupRUN.mxd", "")
print workSpace
env.workspace = workSpace
dirlist=os.listdir(workSpace)

for item in dirlist:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if item.lower().endswith("mdb"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print item
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mdbList.append(item)

arcpy.CreatePersonalGDB_management(workSpace, "Combined.mdb")
destSpace&amp;nbsp; = 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()
 print "Destination MDB - " +str(destSpace)
 print "Source MDB&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - " + str(tempSpace)

 if len(destList) == 0:
&amp;nbsp; for fc in fcList:
&amp;nbsp;&amp;nbsp; arcpy.Copy_management(fc, destSpace + "\\"+fc)
&amp;nbsp;&amp;nbsp; print "copied FC - " +str(fc)
 
 elif len(destList) &amp;gt;=1:
&amp;nbsp; for fc in fcList:
&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(fc)
&amp;nbsp;&amp;nbsp; fcOut = os.path.join(destSpace, desc.name)
&amp;nbsp;&amp;nbsp; for dest in destList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; if fc == dest:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; # print "Source FC&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - "+fc
&amp;nbsp;&amp;nbsp;&amp;nbsp; # print "Destination FC - "+ dest
&amp;nbsp;&amp;nbsp;&amp;nbsp; # print "Destination location - "+ destSpace + "\\" + fc
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Append_management([fc], fcOut, "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))

#for mdb in mdbList:
#for mdb in mdbList:
 
#print mdbList[0]
#tempSpace = mxdPath.replace("SetupRUN.mxd", mdbList[0])
#print tempSpace

#arcpy.CreatePersonalGDB_management(workSpace, "Combined.mdb")
#workSpace_2&amp;nbsp; = mxdPath.replace("SetupRUN.mxd", "Combined.mdb")
#arcpy.Append_management ([mdbList], workSpace_2,"NO_TEST","" ,"")
#arcpy.CreatePersonalGDB_management(workspace, "Combined.mdb")
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:16:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/append-error-in-script/m-p/641595#M50002</guid>
      <dc:creator>AnthonyTimpson2</dc:creator>
      <dc:date>2021-12-12T03:16:03Z</dc:date>
    </item>
  </channel>
</rss>

