daily pastebin goal
38%
SHARE
TWEET

Untitled

a guest Jul 17th, 2017 40 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import arcpy
  2.  
  3. Layer1 = arcpy.GetParameterAsText(0)
  4. Tabela1 = arcpy.GetParameterAsText(1)
  5. Estado = arcpy.GetParameterAsText(2).split(';')
  6. Ano = arcpy.GetParameterAsText(3).split(';')  
  7. mxd = arcpy.mapping.MapDocument("CURRENT")  
  8. Saida = arcpy.GetParameterAsText(4)
  9. stats = []
  10.  
  11. for lyr in arcpy.mapping.ListLayers(mxd):  
  12.     lyr.name = Layer1
  13.     lyr.definitionQuery = """UF IN ({})""".format(Estado)
  14.  
  15. for field in arcpy.ListFields(Tabela1):
  16.     if field.name in (Ano):
  17.         stats.append([field.name, "SUM"])
  18.  
  19. arcpy.Statistics_analysis(Layer1, Saida, stats, "")        
  20. arcpy.RefreshActiveView()
  21. arcpy.RefreshTOC()
  22.    
  23. Traceback (most recent call last):
  24.   File "F:AgroBD.gdbM6a.py", line 19, in <module>
  25.     arcpy.Statistics_analysis(Layer1, Saida, stats, "")
  26.  File "c:program files (x86)arcgisdesktop10.3arcpyarcpyanalysis.py",
  27. line 1160, in Statistics
  28.     raise e
  29. ExecuteError: ERROR 999999: Error executing function.
  30. An invalid SQL statement was used.
  31. An invalid SQL statement was used. [Brasil_Municipios]
  32. An invalid SQL statement was used. [SELECT * FROM Brasil_Municipios WHERE UF
  33. IN ([u'AC', u'AM'])]
  34. An invalid SQL statement was used.
  35. An invalid SQL statement was used. [Brasil_Municipios]
  36. An invalid SQL statement was used. [SELECT OBJECTID FROM Brasil_Municipios
  37. WHERE UF IN ([u'AC', u'AM'])]
  38. The table was not found. [out3]
  39. Failed to execute (Statistics).
  40.  
  41. Failed to execute (Script1).
RAW Paste Data
Top