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'')
1
  • Remove the space in out feature class path
    – BERA
    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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.