I am running a code that uses arcpy.sa.ExtractByMask but it returns: ExecuteError: Failed to execute. Parameters are not valid. ERROR 000824: The tool is not licensed. Failed to execute (ExtractByMask) I know i have spatial analyst licensed and the tool works fine within arcmap itself. Anyone ever come across this? Edit: arcpy.CheckExtension('Spatial') returns 'Available'