Raster Calculator Exception in ArcEngine 10.1

2532
3
04-03-2013 06:09 AM
niroshanshan
New Contributor
Hi,

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.

Niro

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);
try
{
     if (!fileInfo.Directory.Exists) fileInfo.Directory.Create();
     processor.OverwriteOutput = true;
     processor.Execute(RasterCalc, null);
}
catch (Exception ex)
{
     Debug.Assert(false, ex.ToString());
     Debug.Write(GetMessages(processor));
}



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\warnings.py", 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)
0 Kudos
3 Replies
sameerpuppal
Occasional Contributor
Hi,

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.

Niro

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);
try
{
     if (!fileInfo.Directory.Exists) fileInfo.Directory.Create();
     processor.OverwriteOutput = true;
     processor.Execute(RasterCalc, null);
}
catch (Exception ex)
{
     Debug.Assert(false, ex.ToString());
     Debug.Write(GetMessages(processor));
}



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\warnings.py", 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)




Hi,

Did you made this work?
Actually i am struggling with a similar code in VB.NET in 10.1, would really appreciate if you could help.

Regards,
Sameer Puppal
0 Kudos
PhilipBailey
New Contributor
Hi, did you ever figure this out? I am experiencing the same problem and need to solve this too.

Thanks,

Philip
0 Kudos
niroshanshan
New Contributor
No we couldn't get the raster calculator to work.

We worked around the issue by using other raster processing tools (Con, Int, Plus, Minus, Times, Divide, IsNull, etc.) in series.

Regards,
Niro
0 Kudos