AnsweredAssumed Answered

I get invalid syntax

Question asked by ArqEric on Mar 9, 2016
Latest reply on Mar 10, 2016 by ArqEric

I 'm trying to run my script but I get this error message.

 

syntax.jpg

Here is the code.

  1. import arcpy
  2. from arcpy import env
  3. env.workspace = r'D:\Eric\Ejercicio\shp\ejercicioTest.gdb\shp'
  4. crbuff = r'D:\Eric\Ejercicio\shp\ejercicioTest.gdb\shp\CRojaPBuff'
  5. insumo = r'D:\Eric\Ejercicio\shp\ejercicioTest.gdb\shp\Insumo'
  6. # Add field to insumo.
  7. arcpy.AddField_management(insumo, "test", "TEXT", "", "", "50", "", "NULLABLE", "NON_REQUIRED", "")
  8. # Make a layer from crbuff to get the select by location works.
  9. arcpy.MakeFeatureLayer_management (crbuff, 'crbuff_layer')
  10. arcpy.MakeFeatureLayer_management (insumo, 'insumo_layer')
  11. # loop with cursor
  12. cursor = arcpy.SearchCursor(crbuff)
  13. field = "Lab" # Specify the field in the loop.
  14. for row in cursor:
  15.     print (row.getValue(field))
  16.     arcpy.SelectLayerByLocation_management('insumo_layer', "HAVE_THEIR_CENTER_IN", 'crbuff_layer', "", "NEW_SELECTION", "NOT_INVERT")
  17.     # Process: Calculate Field.
  18.     cursorIn = arcpy.UpdateCursor('insumo_layer')
  19.     for row in cursorIn:      
  20.         row.setValue("test", (row.getValue(field))
  21.         cursorIn.updateRow(row)
  22. # Process: Summary Statistics.
  23. intable = r'D:\Eric\Ejercicio\shp\Insumo.shp'
  24. outtable = r'D:\Eric\Ejercicio\shp'
  25. arcpy.Statistics_analysis(intable, outtable + "stats.dbf", "POB1 SUM;POB8 SUM;POB11 SUM;POB14 SUM;POB15 SUM;POB16 SUM;POB24 SUM;POB31 SUM;POB57 SUM;MIG7 SUM;INDI1 SUM;DISC1 SUM;DISC4 SUM;DISC5 SUM;DISC6 SUM;ECO1 SUM;ECO4 SUM;ECO25 SUM;ECO28 SUM;SALUD1 SUM;SALUD2 SUM;SALUD3 SUM;SALUD4 SUM;SALUD5 SUM;SALUD6 SUM", "test")

I need help ...

 

Outcomes