I have a script that requires me to use arcpy.AddToolbox, which I currently have set up for 10.3
arcpy.AddToolbox(r"C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcToolbox\Toolboxes\Spatial Analyst Tools.tbx")
How can I query the version and make the path relative so it will work for other versions, e.g. 10.2 or 10.4 (eventually).
BTW, I thought
import arcpy
arcpy.CheckOutExtension("spatial")
from arcpy.sa import *
would be enough for me to not have to add the toolbox, but that didn't work. If anyone knows why, I'd be curious. Without the full toolbox, it was crashing on arcpy.ExtractValuesToPoints_sa(randomTemp, elevRaster, randomPtSet, "NONE", "VALUE_ONLY")
Thanks.
cross-post python snippets Developers