1

I am new to programming in ArcMap, and am using ArcMap 10.5. When I use the tool Select (Extract-Analysis Tool), the result is what I expect. However, When I run the Phyton Snipped code ArcMap displays: "Parsing error SyntaxError: invalid syntax (line 1)" I have searching the web with no success. Can you tell me how to fix this error? On the other hand, I have to apply the tool 130 times to export the polygons shapes one by one. How can I include the code in a for cycle?

arcpy.Select_analysis(in_features="D:/AKKGIS/cogo_plgs/001_130_cg_plgs.shp", out_feature_class="D:/ AKKGIS/img_clips/001_clp.shp", where_clause='"ppg_id" = '001'')
lambertj
3,1224 gold badges22 silver badges39 bronze badges
asked Apr 25, 2018 at 15:47
1
  • Remove the space in out feature class path Commented May 16, 2018 at 11:00

1 Answer 1

7

You should change where_clause into where_clause='"ppg_id" = \'001\''. (added backward slashes)

You should use apostrophes and double quotes in right way. Please refer to that post: Arcpy query not working.

answered Apr 25, 2018 at 16:12

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.