I have been trying to get a little Python script from this tutorial to run for and hour, and kept getting errors:
import arcgisscripting
gp = arcgisscripting.create()
gp.workspace = “c:/users/arne/downloads/Python_ArcGIS_Lessons/Lesson2/Lesson2″
gp.overwriteoutput = 1
gp.select_analysis(“flowline.shp”, “RBCreek.shp”, ‘ “GNIS_Name” = \’Red Butte Creek\’ ‘)
gp.buffer_analysis(“RBCreek.shp”, “RBCreekBuff.shp”, “100″)
gp.PolygonToRaster_conversion(“RBCreekBuff.shp”, “FID”, “BuffGrd”, “CELL_CENTER”, “NONE”, “30″)
del gp
RESULT:
Traceback (most recent call last):
File “C:\Users\….\xxxxxxx.py”, line 15, in <module>
gp.PolygonToRaster_conversion(“RBCreekBuff.shp”, “FID”, “BuffGrd”, “CELL_CENTER”, “NONE”, “30″)
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000824: The tool is not licensed.
Failed to execute (PolygonToRaster).
Based on google searches for “ERROR 000824: The tool is not licensed.” I tried turning on the Spatial Analyst under ‘Extensions’ in ArcCatalog and ArcMap. I could never get it to work.
SOLUTION
Finally, I found this page here. Apparently you have to “turn on” Spatial Analyst from within the Python script by adding the line:
gp.CheckOutExtension(“Spatial”)
That finally worked !
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.