AnsweredAssumed Answered

Very simple code, don't understand the error

Question asked by dschatt on Jan 30, 2018
Latest reply on Jan 30, 2018 by dschatt

hi, just trying to run a simple code:

 

>>> import arcpy
... arcpy.CheckOutExtension("Spatial")
... arcpy.env.workspace = "C:\stuff\SCHISM_SLR_stuff\Con_Rasters\Con_0625"
... allRasters = arcpy.ListRasters("*","TIF")
... for eachRaster in allRasters:
...    theRaster = Raster(eachRaster)
...    outRaster = 6.25 - theRaster
...    outRaster.save(eachRaster.replace('.tif','_Final.tif'))

 

The error is:
Runtime error
Traceback (most recent call last):
File "<string>", line 6, in <module>
NameError: name 'Raster' is not defined

 

Thanks for any help!

Dan

Outcomes