1

I am new to python, so bear with me. Trying running reclassify in pyscripter returns the error:

Message File Name Line Position
Traceback
21
Reclassify C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\sa\Functions.py 5236
swapper C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\sa\Utils.py 47
wrapper C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\sa\Functions.py 5230
C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\geoprocessing_base.py 498
ExecuteError: ERROR 999999: Error executing function. Failed to open raster dataset Failed to execute (Reclassify).

My code is simple, and it works in the python window in arcmap, so I am guessing it has something to do with how i set pyscripter up. I successfully tried SplineWithBarriers, so it is working:

# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "V:/USER/b/Processing"

# Set local variables
inRaster = "barr7"
reclassField = "VALUE"
remap =  RemapValue([[1,9],[2,8],[3,1],[4,6],[5,3],[6,3],[7,1]])

arcpy.CheckOutExtension("Spatial")

# Execute Reclassify
outReclassify = Reclassify(inRaster, reclassField, remap, "NODATA")
  • I am not using geodatabases. The save part is not responsible for the error, so i removed it from the question. – Jeppe Olsen May 4 '17 at 7:50
  • Yes, its a file of type: "File System Raster". In the python window in ArcMap it is not necessary to specify more. – Jeppe Olsen May 4 '17 at 7:54
  • so what should i add to the barr7? – Jeppe Olsen May 4 '17 at 8:02
  • Let us continue this discussion in chat. – Jeppe Olsen May 4 '17 at 8:07
  • My comments are deleted. See answer. – Mr. Che May 4 '17 at 9:52
1

I just tested this script and it work well, try to use it as an example:

import arcpy

inRaster = r"G:\TEST_DEL\raster.tif"
outRaster = r"G:\TEST_DEL\raster_out.tif"

reclassField = "VALUE"
remap = arcpy.sa.RemapValue([[0,9999]])

arcpy.CheckOutExtension("Spatial")

outReclassify = arcpy.sa.Reclassify(inRaster, reclassField, remap, "NODATA")
outReclassify.save(outRaster)

arcpy.CheckOutExtension("Spatial")

enter image description here

  • This works, not sure why though. You put in r before filenames and arcpy.sa. before RemapValue. But thanks. – Jeppe Olsen May 4 '17 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.