import arcpy# Local variables:myShpFile = "C:\\temp\\stats\\forms\\outputDir\\0arbuckle\\intersect_1.shp"stats_dbf = "C:\\temp\\stats\\waters\\stats.dbf"# Process: Summary Statisticsarcpy.Statistics_analysis(myShpFile, stats_dbf, "field1 MIN;field1 MEAN;field1 MAX;field1 RANGE;field1 STD;field2 MIN;field2 MEAN;field2 MAX;field2 STD;field2 RANGE")
Traceback (most recent call last): File "stats.py", line 19, in <module> File "C:\Program Files (x86)\ArcGIS\Desktop10.0\arcpy\arcpy\analysis.py", line 910, in Statistics raise earcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.ERROR 000840: The value is not a String.ERROR 000840: The value is not a String.Failed to execute (Statistics).
I dont know why it isnt giving you the syntax when you do the snippit copy thing. Thats how many of us get complex syntax without having to type it all out by hand. I think one thing may be the way that model builder formatted your tool. It may have given you the syntax for 9.3.x instead of 10.x. Now the fields and stat type are strings in nested lists.Try:arcpy.Statistics_analysis(myShpFile, stats_dbf, [["field1","MIN"],["field1","MEAN"],["field1","MAX"],["field1","RANGE"],["field1","STD"],["field2","MIN"],["field2","MEAN"],["field2","MAX"],["field2","STD"],["field2","RANGE"]])
Try running the tool outside of a model or script. Go to the results window and right click on the results and select "copy as python snippit." Paste this into IDLE or whatever and compare. Exports from model builder sometimes wonk out like this.
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.