Failed to open raster dataset

Discussion created by triphook3 on Jan 26, 2011
Latest reply on Feb 3, 2012 by kass3
I wrote a python script that works beautifully, but when I try to run it as a script from ArcToolbox, it crashes when I try to do an Extract By Mask.  Here is the problem script:

import arcpy
from arcpy import env
from import *
arcpy.CheckOutExtension("Spatial") # Loads Spatial Analyst extension

dem = arcpy.GetParameterAsText(0)
arcpy.AddMessage(dem) # "C:/Elevation Files/dem_file"
bsnDEM = ExtractByMask(dem, basinFile)

Which raises the error:
<class 'arcgisscripting.ExecuteError'>: ERROR 999999: Error executing function.
Failed to open raster dataset
Failed to execute (ExtractByMask).

Why would this work outside of a tool but not when executed from the toolbox?