TransWikia.com

Zonal Statistics giving ERROR 000824: The tool is not licensed

Geographic Information Systems Asked by MikV89 on January 14, 2021

I have a script and when I run the ZonalStatisticsAsTable I get this error:

  • File "C:Program Files (x86)ArcGISDesktop10.5ArcPyarcpygeoprocessing_base.py", line 510, in
    return lambda *args: val(gp_fixargs(args, True))
    ExecuteError: Failed to execute. Parameters are not valid.
    ERROR 000824: The tool is not licensed.
    Failed to execute (ZonalStatisticsAsTable).

My code is:

flist = []
    for file in files:
        if os.path.isfile(os.path.join(root,file)) and file.endswith('.shp'):
            flist.append(os.path.join(root,file))```

    arcpy.env.workspace =r"Z:EMSV-057_AOIs_Reshape5_Process1_TaskAModelBuilderPruebas_MVEU_AOICAPAS"
    for z in flist:
       shape=z

       erase=arcpy.Erase_analysis(shape,"C:OSM_coastlineswater_polygons.shp", "Tierra", cluster_tolerance="")

       tZONA=arcpy.gp.ZonalStatisticsAsTable_sa(erase, "FID", raster, "Tabla", "NODATA", "ALL")

One Answer

It seems you either don't have a Spatial Analyst license, or you need to enable it. How to enable extensions is described in the Help page on Using Extensions in ArcGIS.

You may also have to import and checkout the extension in your code. modified example from the documentation:

import arcpy
from arcpy.sa import *

class LicenseError(Exception):
    pass

try:
    if arcpy.CheckExtension("Spatial") == "Available":
        arcpy.CheckOutExtension("Spatial")

    else:
        # raise a custom exception
        raise LicenseError

      #Your main code here using spatial analyst

except LicenseError:
    print("Spatial Analyst license is unavailable")
except arcpy.ExecuteError:
    print(arcpy.GetMessages(2))

Correct answer by Will McInnes on January 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP