1

I know I have spatial analyst licensed and the tool works fine within ArcMap but when I try to run this code snippet:

import arcpy

arcpy.CheckExtension('Spatial')  # which returns 'Available'

arcpy.gp.ExtractByMask_sa("D:/Sheyenne/Atmospherically Corrected Landsat/Just_bands/LT50300281984137PAC00_sr_band3.tif", "D:/Sheyenne/sheyenne_area_poly.shp", "D:/Sheyenne/Atmospherically Corrected Landsat/Practice_band_clipLT50300281984137PAC00_sr_band3.tif")

the error returned is:

ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000824: The tool is not licensed.
Failed to execute (ExtractByMask)

Has anyone encountered this before?

0

1 Answer 1

3

You have tested whether an SA license is available with arcpy.CheckExtension('Spatial') but you have not actually checked a license out. To do that you need to use arcpy.CheckOutExtension('Spatial'). You can release the license at the end of the script with arcpy.CheckInExtension('Spatial')

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.