[GIS] ArcGIS ERROR 000824: The tool is not licensed in arcpy

arcmaparcpyerror-000824licensespatial-analyst

I try to run the Zonal Statistic as a Table through ArcPy and it gives me:

ERROR 000824: The tool is not licensed.

Here is the doc for the function: http://resources.arcgis.com/en/help/main/10.1/index.html#//009z000000w8000000

I have tried including the line where it checks for my Spatial Analyst extension:

arcpy.CheckOutExtension("Spatial")

but that just leaves the script running for a long time, way longer than it should (10 minutes+ on a 250Mb raster!)

Do you have a workaround/fix?

I have installed 10.1 Service Pack 1. I have checked and enabled all the extensions.

Furthermore, I have the Advanced/ArcInfo license level.

Best Answer

Wrap the part of your code that needs Spatial Analyst extension as follows

arcpy.CheckOutExtension("spatial")

#your code

arcpy.CheckInExtension("spatial")

By checking out licenses only when you need them and checking them in, you won't hold up licences if other people need to use them. This is useful in a setting where there are fewer licenses than the people who use them in a network environment.

Related Question