gabrisch

script runs fine until it is added as a toolbox script.  Why the error?

Discussion created by gabrisch on Aug 16, 2012
Latest reply on Aug 17, 2012 by gabrisch
This script runs just fine when I hard code the paths to the input data and run it using KomodoIDE.  Once I change the input to arcpy.GetParameterAsText(0), and add the tool as a toolbox script with a multi-value input it throws the error below.  Does anyone know why I am getting this error as a toolbox tool?

Executing: multimultiply I:\SurfaceModels\USGS_DEM\ldeltashd_1ft;I:\SurfaceModels\USGS_DEM\ldeltashd_5ft
Start Time: Thu Aug 16 11:50:22 2012
Running script multimultiply...

Multiplies several raster layers together
Available
PYTHON ERRORS:
Traceback info:
  File "Z:\GISPUB~1\GerryG\PYTHON~1\ASSOCI~1\ProductOfMultipleLayers.py", line 19, in <module>
    Multimultiply(TheRasters)

Error Info:
ERROR 000824: The tool is not licensed.
ArcPy ERRORS:

Completed script multimultiply...
Failed to execute (multimultiply).
Failed at Thu Aug 16 11:50:35 2012 (Elapsed Time: 13.00 seconds)



Here is the code....
try:
    import arcpy, os, sys, traceback
    from arcpy.sa import *
    arcpy.AddMessage("\n\nMultiplies several raster layers together")
    arcpy.CheckOutExtension("Spatial")
    arcpy.AddMessage(arcpy.CheckExtension("Spatial"))
    def Multimultiply(TheRasters):
        numberoflayers = len(TheRasters)
        counter = 1
        theproduct = Raster(TheRasters[0])
        while counter <= numberoflayers - 1:
            theproduct = Times(theproduct, Raster(TheRasters[counter]))
            counter+=1
        theproduct.save("C:/gtemp/aaaaatestras")
    TheRasters = arcpy.GetParameterAsText(0)
    #TheRasters = r"I:\SurfaceModels\USGS_DEM\ldeltashd_5ft;I:\SurfaceModels\USGS_DEM\ldeltashd_1ft"
    TheRasters = TheRasters.split(";")
    Multimultiply(TheRasters)
    arcpy.AddMessage("Done!")  
except arcpy.ExecuteError: 
    msgs = arcpy.GetMessages(2) 
    arcpy.AddError(msgs)  
    print msgs
except:
    tb = sys.exc_info()[2]
    tbinfo = traceback.format_tb(tb)[0]
    pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1])
    msgs = "ArcPy ERRORS:\n" + arcpy.GetMessages(2) + "\n"
    arcpy.AddError(pymsg)
    arcpy.AddError(msgs)
    print pymsg + "\n"
    print msgs

Outcomes