Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

import arcpy

from arcpy import env

from 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))))"C:\classifications\actual_real_deal\CART")

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.

share|improve this question
Perhaps this link from the ESRI Knowledge Base, may shed some light: Error: ERROR 010240: Could not save raster dataset to... – Get Spatial Nov 5 '13 at 21:06
have you tried forward slashes?"C:/classifications/actual_real_deal/CART") – mwil Nov 5 '13 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 '13 at 21:22
@mwil - forward slashes do not work, unfortunately. – Mo Correll Nov 5 '13 at 21:24
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 '13 at 15:22

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"...) but before that.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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