I'm running geoprocessing scripts in IDLE and everything runs exactly as expected until it comes to a function that requires the spatial analyst module. the cost path or zonal statistics tools cause Python to restart immediately (and the Command window to close), without reporting an error. I've ran my script successfully before, but I very recently started to encounter this (bug?) in implementing the script. I've tried to repair ArcGIS 10.2, reinstall it, uninstall it and reinstall 10.1. I've also tried downloading a new version of Python 2.7.6 and added the libraries to get arcpy to import. Again, the script runs until it hits a spatial analyst tool. I've also tried arcpy.sa.ZonalStatisticsAsTable() command in addition to adding "from arcpy.sa import * ." The former worked a couple of times in the Python command window and then it suddenly stopped working. However, running the exact same spatial analyst tools with the exact same inputs in ArcMap works perfectly well. Does anyone have any suggestions for what could be wrong? a bug? I've written my entire model to run in python and now it doesn't work anymore. HELP!