Q:

Using arcpy.gp.Int_sa in ArcMap gives Error 000824 tool is not licensed?

My Arcpy code is not working in ArcMap 10.1 because an error with the last line: 

Error 000824: The tool is not licensed. 

I have all my extensions turned on, so I don't know why I would be getting this error. It seems I only need to import arcpy.sa. 
Did I do this correctly, or are there other modules that should be imported for this code to work?
import arcpy, os, string, glob, sys
from arcpy import env
from arcpy.sa import *

env.workspace = r"C:\VMshared\small_example_valley8\SD2part"
outFolder = r"C:/VMshared/small_example_valley8/SDpartINT/INT"

for rasterFile in arcpy.ListRasters("*.tif"):
    oName, oExt = os.path.splitext(rasterFile + ".tif")
    outRaster = os.path.join(outFolder, oName + ".tif") 
    arcpy.gp.Int_sa(rasterFile,outRaster)

A:

If you are running the tool outside of ArcGIS session, in Python (or when in the Python window and the extension has not already been enabled), you will need to check out an ArcGIS Spatial Analyst extension license before running a tool.
You do it with:
arcpy.CheckOutExtension("Spatial")

