Delete Empty feature from FGDB in Arcgis Pro

492
3
12-09-2017 12:33 PM
PeterVersteeg
Occasional Contributor II

Good Day,

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 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)

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

0 Kudos
3 Replies
JoshuaBixby
MVP Esteemed Contributor

It seems you are asking, "why doesn't this work?"  Seeing this thread is marked as a discussion, not a question, and you don't ask a specific question; I am not sure sure what kind of response you expect or will get here.  If this is in fact a question, marking it so will get more attention.

Assuming this is a question, it would help to have some more information before I try to provide an answer.  What version of Pro are you using?  Did this code work with ArcMap/ArcCatalog?  If so, which version?  You stated, "did not get a error in the analyse tool," could you elaborate a bit more on which tool.  There is an Analysis toolbox , but it has quite a few tools in it.  Finally, what exactly is "not_empty_feature_1?" 

0 Kudos
PeterVersteeg
Occasional Contributor II

Your right i wrongly put this in as a discussion and it meant it as a question although i do not ask it it seems. The question now is how do i change this discussion to a question. For now i will open a question and try to to ask it as clear as possible.   

0 Kudos
JoshuaBixby
MVP Esteemed Contributor
0 Kudos