Delete Empty feature from FGDB in Arcgis Pro

Discussion created by peterverst on Dec 9, 2017
Latest reply on Dec 10, 2017 by bixb0012

Good Day,


One of the scripts i use is:


  1. import arcpy  
  2. from arcpy import env  
  4. env.workspace = r"C:\Temp\Test.gdb"  
  6. listFCs = arcpy.ListFeatureClasses("*")  
  8. for fc in listFCs:  
  9.     count1 = str(arcpy.GetCount_management(fc))  
  10.     if count1 == "0":  
  11.         arcpy.Delete_management(fc)  


In arcgis pro this scripts is giving my this error


Start Time: zaterdag 9 december 2017 21:22:32
Running script DumpEmptyData...
Failed script DumpEmptyData...
Traceback (most recent call last):
File "F:\GIS_Data\Tools\Python Scripts\", line 21, in <module>
count1 = str(arcpy.GetCount_management(fc))
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\", line 16029, in GetCount
raise e
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\", line 16026, in GetCount
retval = convertArcObjectToPythonObject(gp.GetCount_management(*gp_fixargs((in_rows,), True)))
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\geoprocessing\", line 506, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input Rows: Dataset not_empty_feature_1 does not exist or is not supported
Failed to execute (GetCount).
Failed to execute (DumpEmptyData).
Failed at zaterdag 9 december 2017 21:22:33 (Elapsed Time: 0,66 seconds)


I now use the count tool to NOT copy features in the first place (this is even better) but it bugs my why it did not work (did not get a error in the analyse tool)


greetings Peter