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:
- import arcpy
- from arcpy import env
-
- env.workspace = r"C:\Temp\Test.gdb"
-
- listFCs = arcpy.ListFeatureClasses("*")
-
- for fc in listFCs:
- count1 = str(arcpy.GetCount_management(fc))
- if count1 == "0":
- 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