Raster Calculator Exception in ArcEngine 10.1

Discussion created by niroshans on Apr 3, 2013
Latest reply on Jan 23, 2014 by niroshans

We just upgraded from ArcEngine 10 to 10.1 and now the raster calculator does not seem to work anymore.

Whenever I execute the geoprocesing tool, we get a LoaderLock was detected error and we are unable to continue.

If I turn off the Loader Lock exception in Visual Studio, it get's a bit further and the application throws a  C++ Runtime Error R6034 (Application has made an attempt to load the C run time library incorrectly).

If I check the geoprocessing message logs I see a ERROR 000539: Runtime error (AttributeError: 'geoprocessing sys.stdout object' object has no attribute 'write')

When I try to run the same thing in ArcMap's Raster Calculator it works fine.

Any idea what going on? Thanks.


I'm using the following code to execute the raster calculator:

String expression = @"'C:\Temp\RasterCalc\dem_pre' * 10";
String outputPath = @"C:\Temp\FloodPlain24";
Geoprocessor processor = new Geoprocessor();

RasterCalculator RasterCalc = new RasterCalculator(expression, outputPath);
FileInfo fileInfo = new FileInfo(outputPath);
     if (!fileInfo.Directory.Exists) fileInfo.Directory.Create();
     processor.OverwriteOutput = true;
     processor.Execute(RasterCalc, null);
catch (Exception ex)
     Debug.Assert(false, ex.ToString());

The full geoprocessing log is as follows:

Executing: RasterCalculator "'C:\Temp\RasterCalc\dem_pre' * 10" C:\Temp\FloodPlain24
Start Time: Wed Apr 03 09:52:45 2013
Raster(r'C:\Temp\RasterCalc\dem_pre') * 10
ERROR 000539: Runtime error 
Traceback (most recent call last):
  File "C:\Python27\ArcGIS10.1\Lib\", line 29, in _show_warning
    file.write(formatwarning(message, category, filename, lineno, line))
AttributeError: 'geoprocessing sys.stdout object' object has no attribute 'write'

Failed to execute (RasterCalculator).
Failed at Wed Apr 03 09:54:26 2013 (Elapsed Time: 1 minutes 41 seconds)