mtgis

Error Accessing Env.Mask in Python

Discussion created by mtgis on Jul 25, 2013
Latest reply on Jul 26, 2013 by mtgis
Below is a snippet of code that I have been working on that loops through the geometry of multiple features of a shapefile and uses that geometry as a mask to get raster properties. However, I'm stumped as to why I continue to get the following error,

RuntimeError: Object: Error in accessing environment <mask>

import arcpy, os, string, csv
from arcpy import env

winsum = "D:/WERC/GIS_Layers/Summer-Winter Ranges/AllShps/WinterSummer.shp"
env.workspace = workspace
with arcpy.da.SearchCursor(winsum, ['SHAPE@', 'Name', 'Season']) as cursor:
    for row in cursor:
        name = row[1]
        season = row[2]
        env.mask = row[0]
        for raster in arcpy.ListRasters():
            stdResult = arcpy.GetRasterProperties_management(raster, "STD")
            print stdResult
            meanResult = arcpy.GetRasterProperties_management(raster, "MEAN")
            print meanResult
            minResult = arcpy.GetRasterProperties_management(raster, "MINIMUM")
            print minResult
            maxResult = arcpy.GetRasterProperties_management(raster, "MAXIMUM")
            print maxResult


If anyone could point me in the right direction it would be much appreciated. Thanks!

Outcomes