Error 000732 when trying to run MakeFeatureLayer

Discussion created by cotterrj on Sep 27, 2012
Latest reply on Oct 1, 2012 by mzcoyle
I am fairly new to Python, so bear with me. I am writing a script which loops through a folder containing multiple rasters, and exports polygons from the rasters.  I have gotten the script to reclassify cells using 'Slice', and can output shapefiles, but when I try to MakeFeatureLayer(i need to do this to select certain polygons) from the shapefile it is giving me error 000732 which says the shapefile doesn't exist.

Below is a snippet from the code....I just cant get it to recognize that the shapefile does indeed exist.

import arcpy
from arcpy import env

arcpy.env.workspace = arcpy.GetParameterAsText(0)


    fcs = arcpy.ListRasters()

    for fc in fcs:
        outRaster = "reclass_" + fc

        #Reclassify's raster cells
        arcpy.Slice_3d(fc, outRaster, 2, "EQUAL_INTERVAL")

        outShp = fc.strip(".tif")

        #converts raster to polygon shapefile
        arcpy.RasterToPolygon_conversion(outRaster, outShp, "SIMPLIFY", "VALUE" )  

        outLyr = outShp + "_lyr"

        #make layer from shapefile so I can select by attribute
        arcpy.MakeFeatureLayer_management(outShp, outLyr)
        arcpy.SelectLayerByAttribute_management(outLyr, "NEW_SELECTION", ' "GRIDCODE" = 1 ')

Thanks for any help!