AnsweredAssumed Answered

How to delete empty features in a FGDB in ArcGis Pro

Question asked by peterverst on Dec 10, 2017
Latest reply on Dec 14, 2017 by bixb0012

Good Day,

 

I would like to delete empty features in a FGDB. In ArcMap (10.5.1) i used this script and it worked fine.

 

One of the scripts i use is:

 

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

 

In arcgis pro (2.0.1) 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\DeleteEmptyfields.py", line 21, in <module>
count1 = str(arcpy.GetCount_management(fc))
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 16029, in GetCount
raise e
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 16026, in GetCount
retval = convertArcObjectToPythonObject(gp.GetCount_management(*gp_fixargs((in_rows,), True)))
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\geoprocessing\_base.py", 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)

 

So the question is why do i get this error.

 

The test above is with a feature  called "not_empty_feature". I used the "Analyze tools for pro" tool to analyze the script  but it did not give me any errors. Analyze Tools For Pro—Data Management toolbox | ArcGIS Desktop 

 

 

 

greetings Peter

Outcomes