Sorry about that....Yes it is the outShp variable that the script doesn't recognize
I would imagine you are looking for an actual shapefile (.shp) to create the feature layer from? Or did you create a feature class in a geodatabase?I'd try something like this, probably not really needed depending on your needs, but you should be able to adapt to your purposes if the output type/extension is the issue you are indeed having.import arcpy
outWorkspace = arcpy.GetParameterAsText(0)
arcpy.env.workspace = outWorkspace
arcpy.CheckOutExtension("3D")
try:
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")
if outWorkspace.endswith(".gdb"):
output_type = "FGDB"
output = os.path.join(outWorkspace, "%s" % outShp)
elif outWorkspace.endswith(".mdb"):
output_type = "PGDB"
output = os.path.join(outWorkspace, "%s" % outShp)
else:
output_type = "SHP"
output = os.path.join(outWorkspace, "%s.shp" % outShp)
#converts raster to polygon shapefile
arcpy.RasterToPolygon_conversion(outRaster, output, "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 ')