A error in my previously-smooth-running arcpy script has me confounded. The error occurs where the script selects individual features in two different feature classes, and then performs an Erase function.

It seems to be working fine for the first one or two files that it erases, but then stops with "Error 000210: Cannot create output."

Using arcpy.GetMessages gives greater detail...

ERROR 000210: Cannot create output The XML being loaded could not be parsed. [GDB_Items] The XML being loaded could not be parsed. [XML document must have a top level element. XML document must have a top level element.

The only useful info online I've found suggested restarting the script each time it fails, which works - in that I restart, and the script moves on to the next item in line to be processed .

This is (most of) the offending script, and I've highlight where the Error is coming from:

import arcpy
from arcpy import env
import time
from time import strftime

#Set overwrite output
arcpy.env.overwriteOutput = True
print arcpy.env.overwriteOutput

donutlog = "C:\\BOEM\\Donuts\\donut_log.txt"
workspace = "C:\\BOEM\\pt_buff2\\"
fileList = []
buffersd4 = []
buffersd3 = []

buffs = workspace+"buffer.gdb"
directorypath = buffs

#Insert test to see if ID was done around here:
finishedIDs = {}

FClist = []
with open(donutlog) as f:
    for line in f:
        if line.startswith("Executing"):
            FCname=line.split(' ')

for dirpath, dirnames, fgdb in arcpy.da.Walk(directorypath,
    for fc in fgdb:
        if fc.endswith("d4"):
            if fc in FClist:
                print fc + " has already been looked at!"

                #list features by APR16_ID in that fc
                APR16_ID4 = [row[0] for row in arcpy.da.SearchCursor(buffs+"\\"+fc,['APR16_ID'])]

                # make feat layer of fc_endswith_d4
                in_feat4 = buffs+"\\"+fc
                out_layer4 = fc+"_lyr"
                print "Make Feature Layer for " + fc

                #make feat layer of fc_endswith_d3
                in_feat3 = buffs +"\\"+ fc[:-2]+"d3"
                out_layer3 = fc[:-2]+"d3"
                arcpy.MakeFeatureLayer_management(in_feat3, out_layer3)
                print "Make Feature Layer for " + in_feat3
                for ID4 in APR16_ID4:
                    where_clause4=""" "APR16_ID" = """ + "'"+ID4+"'"
                    erase_out= "C:\\BOEM\\Donuts\\Donuts_d4_output.gdb\\"+"don_d4_"+ID4
                    ### Error in the Erase function here: 
                    arcpy.Erase_analysis(out_layer4, out_layer3,erase_out,"")
                    print "Erase "+ out_layer3 +" from "+out_layer4+" to produce "+erase_out
                    print arcpy.GetMessages()
                    print "___"
  • could you post your xml file you are trying to erase?
    – Moggy
    Jul 17, 2013 at 21:05
  • Hi Moggy, the trouble is I'm not trying to erase an XML file. I'm working from a Python script that selects 1 feature from each of two feature classes, and then erases one from the other. I think there's something in the conversion from arcpy object to python object
    – SharonB
    Jul 18, 2013 at 12:40
  • ah ok, i assumed the .xml was part of the shapefile cluster
    – Moggy
    Jul 18, 2013 at 14:32

1 Answer 1


This isn't strictly the solution to my question, since I don't even specifically know what the problem was (and thus how to refine the question).

However, maybe someone with a similar issue will stumble on my question and the following solution, which did work (even if I don't know why).

I simply created a new output destination file geodatabase. That's it. But, script is running happily. Hope someone else can save 3 days of pointless script-tinkering and frustration!

  • It seems the erase_out dataset may already exist in your file geodatabase. I would check for the existence of erase_out and delete it or skip that ID4. I know you enabled overwriteOutput.
    – klewis
    Sep 17, 2013 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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