1

I am trying to delete several feature classes from a file geodatabase using values stored in a user defined list.

The script runs without error but it does not delete the feature classes.

Any suggestions to what I am doing wrong (using ArcMap 10.3)?

import arcpy

arcpy.env.workspace = r"C:\Data\Temp.gdb"

fc_Delete = ["fcOut1a","fc_Out2a","fc_Out3a"]

for fc in fc_Delete:
    if arcpy.Exists(fc):
        arcpy.Delete_management(fc,"")
  • 1
    Try removing the empty string parameter (ie. "") in the arcpy,delete function – MacroZED Jan 3 '17 at 13:58
  • Does the results window identify whether to Delete tool was executed or not? If so, the "messages" part will identify which feature class was deleted per iteration of the tool. – reevesii Jan 3 '17 at 17:25
2

Your code is correct, however I would remove the empty string part of the arcpy delete function.

ie:

arcpy.Delete_management(fc)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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