The method I use is:
if arcpy.CheckExtension("Spatial") == "Available":
arcpy.AddMessage("Checking out Spatial")
arcpy.AddError("Unable to get spatial analyst extension")
and then at the end of your script:
which is generically what Ken said, the issue here seems to be that for some external reason arcpy cannot get a license... when using
arcpy.sa in a standalone script it is possible to have more than one license checked out (perhaps that's a bug worth reporting to Esri).. check your task manager to ensure there's not ArcCatalog/ArcMap that's half crashed and still holding a license, script windows that have not been exited and also editors that have imported arcpy (PyWin does this if you
import arcpy in the interactive window).
Worst case restart your computer... it's amazing how many things that fixes.