Raster calculator: Python script from Model Builder: Does not work

Discussion created by zia207 on Aug 19, 2011
Latest reply on Jul 29, 2013 by rzufelt
Following script imported from Model builder. I want run it for other states,  it did not work. If python does not support  "arcpy.gp.RasterCalculator_sa" funtion, if there any away to perform following expresion using a python script?

Raster calculator expresion: Con("ia_corn" == 1,"soilmu_in_90")
Where ia_corn is a binary gird ( 1 and 0) and soilmi_in_90 an interger grid.  I want to import values from soilmi_in_90  to ia_corn.

# ---------------------------------------------------------------------------
# cornMUKEY.py
# Created on: 2011-08-19 15:54:25.00000
#   (generated by ArcGIS/ModelBuilder)
# Description:
# ---------------------------------------------------------------------------

# Import arcpy module
import arcpy

# Check out any necessary licenses

# Local variables:
in_corn ="K:\\CropLand\\STATE.gdb\\in_corn"
soilmu_in_90 = "K:\\STATE_ MUKEY\\RASTER.gdb\\soilmu_in_90"
csoilmu_in = "K:\\STATE_ MUKEY\\CORN_MUKEY.gdb\\csoilmu_in"

# Process: Raster Calculator
arcpy.gp.RasterCalculator_sa("Con(\"%in_corn%\" == 1,\"%soilmu_in_90%\")", csoilmu_in)
print arcpy.GetMessages

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

Traceback (most recent call last):
  File "K:\SCRIPT\Python_Script\cornMUKEY.py", line 21, in <module>
    arcpy.gp.RasterCalculator_sa("Con(\"%in_corn%\" == 1,\"%soilmu_in_90%\")", csoilmu_in)
  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.RuntimeError'>: ERROR 000732: Input Raster: Dataset %soilmu_in_90% does not exist or is not supported
Failed to execute (RasterCalculator).