Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

whereClause syntax error

$
0
0
All,

The script is almost complete. I am attempting to have the user input the six values as strings, then the script selects and zooms to feature. I am running into a syntax error within the whereClause. Any suggestions as to why?

Code:

#Import
import arcpy

#Variables

TOWNSHIP = arcpy.GetParameterAsText(0)
RANGE = arcpy.GetParameterAsText(1)
SEC = arcpy.GetParameterAsText(2)
SUBCODE = arcpy.GetParameterAsText(3)
BLOCK = arcpy.GetParameterAsText(4)
LOT = arcpy.GetParameterAsText(5)

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
lyr = arcpy.mapping.ListLayers(mxd, "Parcels", df)[0]

#Logic
try:
        whereClause = ""TOWNSHIP" AND "RANGE" AND "SEC" AND "SUBCODE" AND "BLOCK" AND "LOT" = '"+Parcels+"'"
        arcpy.SelectLayerByAttribute_management(lyr, "NEW_SELECTION", whereClause)
        df.extent = lyr.getSelectedExtent()
        df.scale = df.scale*1.1

except:
        print arcpy.GetMessages()


Viewing all articles
Browse latest Browse all 2485