Spatial Analysis License Unavailable or Disabled After Python script:  Error 010096

Discussion created by clarksu on Aug 29, 2012
Latest reply on Aug 30, 2012 by clarksu
I get an Error 010096 when I try to use the Zonal Statistics As Table system tool after running a custom tool that I wrote.  The tool I wrote uses the arcpy version of Zonal Statistics as Table.  I have to turn off then on the Spatial Analyst extension (under Customize->Extension) to get the tool to work again.  Is there anyway to turn the extension back on in my tool? 

I'm running ArcGIS 10 for Desktop, so I'm the only one using the extensions.  I check the extension out and in inside my script.  I've tried deleting variables and doing garbage collection, but I still have the problem.  I can run my tool multiple times in my row; however, I can't run the Zonal Statistics as Table system tool without first turning off then on the spatial analyst.

You can look at the whole tool,