bjebn

Raster Calculator Python

Discussion created by bjebn on Nov 28, 2011
Latest reply on Nov 29, 2011 by rafaelr
Hi Everyone,

I am trying to implement a simple raster calculator within my python script as the following
arcpy.gp.RasterCalculator_sa("\"%Temp4%\"/2", Temp2)


But I am receiving the following error in python

"Warning (from warnings module):
  File "<string>", line 1
SyntaxWarning: import * only allowed at module level

Traceback (most recent call last):
  File "F:\test.py", line 75, in <module>
    arcpy.gp.RasterCalculator_sa("\"%Temp4%\"/2", Temp2)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\_base.py", line 474, in <lambda>
    return lambda *args: val(*gp_fixargs(args))
ExecuteError: ERROR 000539: Error running expression: rcexec() <type 'exceptions.TypeError'>: unsupported operand type(s) for /: 'str' and 'int'
Failed to execute (RasterCalculator)."

I am using arcpy.CheckOutExtension("spatial") so im not sure what the first point of the error is implying!

This is really frustrating... any help would be appreciated!

Bjebn

Outcomes