I am receiving the following error when trying to run the following code:

import arcpy

from arcpy import env

from arcpy.sa import *

arcpy.CheckOutExtension = "Spatial"

env.workspace = r"C:\final_mosaic_files\for_python"

Z3 = Raster("mos_zb3")

Z4 = Raster("mos_zb4")

PC2 = Raster("pca_finb2")

outCon = Con(Z4 < -0.9274,2, Con(Z3 <-0.6223,2, Con(PC2 > 1.13,2, Con(Z3 <-0.05342,2,1))))


The error is:

RuntimeError: ERROR 010240: Could not save raster dataset to C:\Users\User\Documents\Mo with output format GRID.

I have tried changing the destination folder, and the file does not currently exist in the directory, and the values of the raster are within GRID parameters for the type of format. The input rasters are mosaics of z-score values of 12 landsat images delineating coastal marsh in the northeast. The cell size is 30X30m, using WGS1984 coordinate system, no projection system. I have tried running the script with .tif file format instead of GRID, which does not work, throwing another error (file Z3 does not exist or is not supported). I have also tried running the script with other, smaller GRID files, which throws the same error 010240.

  • 1
    Perhaps this link from the ESRI Knowledge Base, may shed some light: Error: ERROR 010240: Could not save raster dataset to... Nov 5, 2013 at 21:06
  • 3
    have you tried forward slashes? outCon.save("C:/classifications/actual_real_deal/CART")
    – mwil
    Nov 5, 2013 at 21:15
  • @Get Spatial - my raster is not from NLCD. I have also tried checking the destination folder, and there was no raster produced, as the error indicates.
    – Mo Correll
    Nov 5, 2013 at 21:22
  • @mwil - forward slashes do not work, unfortunately.
    – Mo Correll
    Nov 5, 2013 at 21:24
  • 1
    sometimes my raster output goofs if i haven't set: arcpy.env.snapRaster = snapraster-path and arcpy.env.extent = "MAXOF". not sure if that will help with this error and i can't currently test. can you troubleshoot by checking that you are able to create each of your con statements as individual rasters?
    – mwil
    Nov 6, 2013 at 15:22

1 Answer 1


You need to change your %Temp% directory, it's trying to save the temporary result of the Con operation to your user folder (C:\Users\User\Documents\Mo Correll\ArcGis\) where is something like xx001258 and tripping over the space in your user name.

Make a folder on your 'c' root called MoTemp or something like that and set your temp and tmp environment variables to point there.

The isssue is not with the outCon.save(r"...) but before that.

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.