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

Select Layer by attributes PYthon scripting through files

$
0
0
Hi guys,

Just a quick question as i've been having trouble with my python script that I"ve been trying to implement. The issue here is that everytime when I try to run my script, I keep getting the following error

ERROR 000358: Invalid expression
Failed to execute (SelectLayerByAttribute).


I believe there's an issue with the following section with its expression, but i'm not very clear how i can fix this. Anythoughts on this would be greatly appreciated!

#select layer by attributes
arcpy.MakeFeatureLayer_management(unionwtrshd, 'unionwtrshdlyr')
exp2 = " \"FIDPAO_" + str(ws_id) + "\" = -1"
arcpy.SelectLayerByAttribute_management('unionwtrshdlyr', "NEW_SELECTION", exp2)

and fyi, str(wd_id) is already defined.

Essentially i'm trying to run a script where it goes through each files and grab their respective field 'FIDPAO_(wd_id)"


Thanks!

Viewing all articles
Browse latest Browse all 2485

Trending Articles