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:
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
GetCount_management you need to get the result
result = arcpy.GetCount_management(lyrfile)
count = int(result.getOutput(0))
Hoi Dan,
Thank you for the reply. The Int(result.getOutput(0)) is this the new approach for Pro? I do not understand why this:
is not working anymore.
The help in ArcMap also clearly states that this is the way to do it (see: Get Count—Help | ArcGIS Desktop ). I don't think it has changed in that aspect. You should treat the count as numeric.
Yes i did see that so the new script is:
It is working in Arcmap (10.5.1) but still i got the same error in Arcgis Pro (2.0.1).
I tested in 2.0.1... so no clue in your case, perhaps there is something else wrong, like you aren't querying a layer (in the TOC or on disk... maybe a featureclass??)
I am quarrying a FGDB
http://pro.arcgis.com/en/pro-app/tool-reference/data-management/get-count.htm
There are 2 examples.. the first is how to use the getcount in immediate mode in the python window within arcmap. The second is how to use it from a standalone script, querying a layer file (*.lyr). You useage appears to be somewhere in the middle, which I guess isn't working.
Can you elaborate on the type of feature class you are querying? Since the function works in general with ArcGIS Pro, there must be something different/unique/corrupted with the feature class that Pro isn't working with.
In arcgis Pro (2.0.1) i use a file geodatabase. In that gdb i have two feature classes (poly). 1 feature class is empty the other one has 1 feature.
Esri support is helping me on this one because something is not right on my end it seams. The same tool is working on there machine. I started a new project and now the tool is not giving me any error but it is not deleting the empty feature. Again if i run the same tool in ArcMap (10.5.1) it runs and deletes the empty feature as it should.
If i know more from esri support i let it know