[GIS] ArcGIS Raster Calculator fails with Error 000539

arcgis-10.2arcgis-desktoperror-000539raster-calculator

I have been using Raster Calculator in ArcMap 10.2, today it started returning error 000539 for all actions. Previously it had worked fine. I have not made any change ot my ArcGIS, Python, or Windows 7 installation.

This is the error message I get:

Messages
Executing: RasterCalculator ""Carbon"  + 2" C:\Users\mem48\Documents\ArcGIS\Default.gdb\rastercalc6
Start Time: Tue Mar 17 15:48:30 2015
Raster(r"Carbon")  + 2
ERROR 000539: Error running expression: rcexec() 
Traceback (most recent call last):
  File "<expression>", line 1, in <module>
  File "<string>", line 2, in rcexec
  File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\__init__.py", line 24, in <module>
    from arcpy.toolbox import *
  File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\toolbox.py", line 351, in <module>
    from management import Graph, GraphTemplate
  File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\management.py", line 22, in <module>
    import _management
  File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\_management.py", line 14, in <module>
    import _graph
  File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\_graph.py", line 27, in <module>
    import numpy
  File "C:\Python27\ArcGIS10.2\Lib\site-packages\numpy\__init__.py", line 137, in <module>
    import add_newdocs
  File "C:\Python27\ArcGIS10.2\Lib\site-packages\numpy\add_newdocs.py", line 9, in <module>
    from numpy.lib import add_newdoc
  File "C:\Python27\ArcGIS10.2\Lib\site-packages\numpy\lib\__init__.py", line 4, in <module>
    from type_check import *
  File "C:\Python27\ArcGIS10.2\Lib\site-packages\numpy\lib\type_check.py", line 8, in <module>
    import numpy.core.numeric as _nx
  File "C:\Python27\ArcGIS10.2\Lib\site-packages\numpy\core\__init__.py", line 5, in <module>
    import multiarray
ImportError: DLL load failed: %1 is not a valid Win32 application.

Failed to execute (RasterCalculator).
Failed at Tue Mar 17 15:48:33 2015 (Elapsed Time: 3.37 seconds)

All the files mentioned in the message are present. I've tried using different inputs, output locations, and expressions. It seems that Raster Calculator has just failed completely.

What is wrong and how do I fix it?

Best Answer

As suggested, a possible answer is posted. It seems that arcgis-desktop can't call the raster calculator tool from within a python code, either with arcpy, or from python in model builder. Thus any call for raster calculator from a python code would end with an error. See attached link to ESRI support for thie error (#000539).

As mentioned in ESRI support, arcmap Math toolset can be used to workaround the problem. I suggest map algebra expressions as well, that should work within a python code. In the mag algebra link - the first raster calculator method, is irrelevant for this post, yer the python window or python IDE may both be valid.

Related Question