I keep getting an error at line 22 of my code. It is telling me there is something wrong with my syntax. I have tried it a few different ways but have not been able to figure it out. Can anyone help?
Look at your line 20.
Maybe you wanted to comment that out? The syntax in that line is incorrect.
BTW - to post python code, you can use the syntax highlighter and select python. when commenting, this is found in the ...More pulldown.
I see a couple of things. First, do not use closed parenthesis on line 20. Use indentation for the command. Since the command variables are in parenthesis, there is no need for a backslash. And line 22 syntax is incorrect.
arcpy.Select_analysis("Locations_lyr", r"M:\NRD_Maps\etc", '"Marker" = "' + sitename + '"')
Lines 23-25 and 28-29 should also use indentation.
Perhaps line 22 should be like this:
'\'"Marker" = \\\'' + sitename + '\\\'\''
There is some discussion on this command here regarding the where clause.
On a peripheral note, you would be advised to locate your work in a shorter path structure since there are acceptable limits for certain data types and the error message returned has nothing to do with the length of the path, severely restricting one's ability to track down errors.
Retrieving data ...