Select to view content in your preferred language

AttributeError: 'Raster' object attribute 'save' is read-only

2565
3
07-08-2011 09:17 AM
marvinboyd
Emerging Contributor
Hello all,

I'm having a bit of trouble with some batch processing; specifically with the .save portion of the loop in the code below.  Everytime I try to save any raster calculation I receive the following error:

AttributeError: 'Raster' object attribute 'save' is read-only

I'm hoping there is a work-around or an error with my code; any suggestions would be greatly appreciated.


rasts = arcpy.ListRasters()

for rast in rasts:
       output = outdir + "/" + str(rast) + "_stage"
       outCon = Con(Raster(rast),1)

       outCon.save = output
Tags (2)
0 Kudos
3 Replies
ChrisBater
Deactivated User
What about:

outCon.save(output)
marvinboyd
Emerging Contributor
Chris,

Thank you; it works now!  I'm glad this was operator error and not a more sinister permissions issue.
0 Kudos
MichaelHarrop
Emerging Contributor
Hi, I'm receiving the same error

I've tried to move the output to various places but still same same issue of:
    outReclassify.save = (output)
AttributeError: 'Raster' object attribute 'save' is read-only




inRaster = "J:\develop\DEGURBA\python\dgurba.gdb\POPL_DENS_GR_1KM_2006_GEOSTAT"
reclassField = "Value"
remap = RemapRange ([[0, 300, "NODATA"],[300, 1000000, 1]] )
output = "j:\\develop\\DEGURBA\\outreclass02"


outReclassify = Reclassify(inRaster, reclassField, remap, "NODATA")
outReclassify.save = (output)
0 Kudos