Hello Folks,
I am not a programmer but am getting more and more familiar with ArcPy with ArcGIS Pro these days. I have purchased a digital book that has proven quite useful too. That being said, I am receiving the following error when executing a toolbox script (.py):
Again, it works fine when run from ArcMap or ArcCatalog and even does what it's supposed to do in Pro but throws the error below .I have also updated my project packages but do get errors when trying to do certain updates or install Spyder from there. Any ideas are much appreciated.
Start Time: Monday, May 29, 2023 3:30:17 PM
NM_wind
ShapeFile
1328
Nothing to Delete
Test
FeatureClass
0
EMPTY VECTOR DATASET DELETED
Traceback (most recent call last): File "C:\Users\zach.edwards\OneDrive - Western Data Systems\Documents\AllTerraCentral\Python\ListFCFeaturesRecursivelyCountNameReportDeletezero_PRO.py", line 33, in <module> if int(arcpy.GetCount_management(layerName).getOutput(0)) == 0: File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 23607, in GetCount raise e File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 23604, 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 512, in <lambda> return lambda *args: val(*gp_fixargs(args, True)) arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.ERROR 000840: The value is not a Table View.ERROR 000840: The value is not a Raster Layer. Failed to execute (GetCount)
The actual .py is pasted here below...
Solved! Go to Solution.
Is the file corrupt? If its a shapefile, does it have all the necessary files (shp, dbf, shx) with it? Try getting the count of data before making it a feature layer to see if it's the method or the file.