Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Here we go!

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 "___"

Thanks for any and all ideas.

share|improve this question
could you post your xml file you are trying to erase? –  Moggy Jul 17 '13 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 '13 at 12:40
ah ok, i assumed the .xml was part of the shapefile cluster –  Moggy Jul 18 '13 at 14:32
add comment

1 Answer

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!

share|improve this answer
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 '13 at 17:55
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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