How to delete empty features in a FGDB in ArcGis Pro

2358
11
12-10-2017 09:42 AM
PeterVersteeg
Occasional Contributor II

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

0 Kudos
11 Replies
PeterVersteeg
Occasional Contributor II

Yesterday I got same help from Esri but the script is stil not working on my machine. In fact the delete tool is not working. It runs without error but it is not deleting the feature. The tool and script are working on other computers so Esri could not help anymore. Realy frustrating becouse i have a new HP 640 workstation latest version Windows 10 latest version Arcgis Pro. I spent to much time allready searching if something is locking the features somehow.

After the weekend I will delete this question.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Since Pro installs/uninstalls fairly quickly, have you tried fully uninstalling and reinstalling Pro? 

0 Kudos