npai

Select by attributes

Discussion created by npai on Dec 20, 2011
Latest reply on Dec 20, 2011 by npai
I want to replicate something that I can do within ArcMap and model builder. I have a categorical raster with an attribute table consisting of 10 fields "Rowid", "Value", and "Count". I would like to use the SelectLayerByAttribute_Management tool using arcpy. My code so far is:

# Import arcpy module
import arcpy


# define the location of raster titled rstName
Rst = "C:/..../rstName"

# Select Rowid = 0
arcpy.SelectLayerByAttribute_management(Rst, "NEW_SELECTION", "\"Rowid\" = 0")

The error msg I get is:
* File "C:\...\abc.py", line 16, in <module>
*** arcpy.SelectLayerByAttribute_management(Rst, "NEW_SELECTION", "\"Rowid\" = 0")
* File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\management.py", line 4259, in SelectLayerByAttribute
*** raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000840: The value is not a Table View.
ERROR 000825: The value is not a layer or table view
ERROR 000840: The value is not a Mosaic Layer.
Failed to execute (SelectLayerByAttribute).
-------------------------

Can some help me troubleshoot this issue?

Outcomes