ecallah573

Script randomly fails when modifying file geodatabase

Discussion created by ecallah573 on Aug 15, 2012
Latest reply on Aug 15, 2012 by mzcoyle
I have a script that performs a number of operations on a file geodatabase of which the below code snippet is the first one.  It will need to run up to several times per day.  Most of time the all operates in the script complete without error.  However, occasionally the script fails to write or delete features to the geodatabase when it is run.  No other processes are accessing the geodatabase except the python script.

It will give me the error failed to delete shape X from geodatabase Y.  After the error if I re-run the script without any changes it completes without error.

Any ideas what I could be doing wrong?

import arcpy

SDB = ("example.gdb")
arcpy.env.overwriteOutput = True

def cleanup():
    arcpy.env.workspace = SDB
    features = arcpy.ListFeatureClasses("*")

    for each in features:
        arcpy.Delete_management(each)

cleanup()

Outcomes