0

To start, I found a similar question posted on stack exchange here, but I am not using the zonal statistics tool, which the answer to that question is based on.

With that out of the way, I'm attempting to write a very simple arcpy script. The purpose of the script is to reclassify the values of an input raster, and save the output to a folder.

Currently I'm using this script in a toolbox. I am using arcpy "GetParameterAsText" to determine the input file and output folder. I have tried using raw file paths instead of using GetParameter, but the script still fails. The file paths I use never include spaces, so I think that can be ruled out.

Here is the code:

#Import libraries
import arcpy, sys, os
arcpy.env.overwriteOutput = True
from arcpy import env
from arcpy.sa import *

#Have tried GetParameter as well as raw file paths/names
input = arcpy.GetParameterAsText(0)
saveFolder = arcpy.GetParameterAsText (1)

#Have confirmed following line works using the python window within arcmap
planAreas = Reclassify(input, "VALUE", RemapRange([[100, 169, 0], [170, 179, 1]])) 

planAreas.save(saveFolder) #Crashes here

If I run just the "Reclassify" function in the ArcMap python window, it successfully saves an output as a feature class in Default.gdb. Running the very same code, but in an python script using the save function, crashes with the dreaded error 999998.

I am using Arc version 10.6.1

1

1 Answer 1

3

planAreas.save(saveFolder) should be a file path not a folder path.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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