AnsweredAssumed Answered

Running Cell Stat from copied Python command produces error

Question asked by GabrielFM on Jan 7, 2019
Latest reply on Jan 16, 2019 by dflater-esristaff

When I run Cell Statistics from the UI, then copy the python command from History and paste it into the Python window, it produces an error: 

TypeError: CellStatistics() takes from 1 to 3 positional arguments but 4 were given. 

The only modification I made to the script was changing the name of the output. 


Here's the code:

arcpy.ia.CellStatistics(r"'WindSpeed\WindSpd_10_HTGL1/9/2019 6:00:00 PM';'WindSpeed\WindSpd_10_HTGL1/9/2019 12:00:00 PM';'WindSpeed\WindSpd_10_HTGL1/9/2019 6:00:00 AM';WindSpeed\WindSpd_10_HTGL1/9/2019;'WindSpeed\WindSpd_10_HTGL1/8/2019 6:00:00 PM';'WindSpeed\WindSpd_10_HTGL1/8/2019 12:00:00 PM';'WindSpeed\WindSpd_10_HTGL1/8/2019 6:00:00 AM';WindSpeed\WindSpd_10_HTGL1/8/2019;'WindSpeed\WindSpd_10_HTGL1/7/2019 6:00:00 PM';'WindSpeed\WindSpd_10_HTGL1/7/2019 12:00:00 PM';'WindSpeed\WindSpd_10_HTGL1/7/2019 6:00:00 AM';WindSpeed\WindSpd_10_HTGL1/7/2019;'WindSpeed\WindSpd_10_HTGL1/6/2019 6:00:00 PM';'WindSpeed\WindSpd_10_HTGL1/6/2019 12:00:00 PM';'WindSpeed\WindSpd_10_HTGL1/6/2019 6:00:00 AM';WindSpeed\WindSpd_10_HTGL1/10/2019", r"C:\Users\gmarcus\Documents\ArcGIS\Projects\MyProject4\MyProject4.gdb\WindSpdMaxde", "MAXIMUM", "DATA")


Why would the python that ArcGIS Pro produces cause an error? Is this yet another example of a line of python produced by ArcGIS Pro that is known to not work? 

I'm aware that when copying the Python from Raster Calculator also doesn't work. It seems lame to allow a user to copy a Python snippet when it won't work. Looking at the example of Cell Statistics in the documentation, it seems like this is another example of this approach. WHY ARE YOU DOING THIS ESRI?!