I'm trying to write a script that deletes the rasters that have no information at all. Some people told me to use the try/except, using the statistics as a factor to determine if the information exist or not. But when I run the script in my model, it says it's complete, but the image with no information is still there! What am I doing wrong?
This is the script:
import arcpy from arcpy import env arcpy.env.workspace = arcpy.GetParameterAsText(0) rasters = arcpy.ListRasters("*", "TIF") for raster in rasters: try: arcpy.GetRasterProperties_management (raster, "MINIMUM", "") except: arcpy.Delete_management(raster,"")