<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Running Python script that is exported from model builder in ArcGIS GeoStatistical Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-geostatistical-analyst-questions/running-python-script-that-is-exported-from-model/m-p/194033#M491</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you try hard-coding the values in the script and see if that works?&amp;nbsp; Also when hard-coding the values, just run the script through IDLE.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Mar 2014 15:49:55 GMT</pubDate>
    <dc:creator>MichaelVolz</dc:creator>
    <dc:date>2014-03-06T15:49:55Z</dc:date>
    <item>
      <title>Running Python script that is exported from model builder</title>
      <link>https://community.esri.com/t5/arcgis-geostatistical-analyst-questions/running-python-script-that-is-exported-from-model/m-p/194031#M489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So I???ve put up a simple model involving Kernel interpolation with barrier tool in ArcMap model builder and exported to Python script. (since the script is fairly short, I???ve pasted it down below.)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I feel the script is fine. But after I added to my toolbox in ArcMap and try to run it, some error pops up. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After a whole morning???s debugging, alas, I???ve finally managed to get ArcMap to crash every time I run my script... &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am guessing the problem is with the parameters I added to the script. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could anyone explain a bit on how one should make sure a python script could be run from the toolbox and all parameters are called correctly. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;More specifically: when I add parameters in ArcMap, given the python script that I already have, what display names should I put down for the parameters so that the software recognizes. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any input is welcome and appreciated. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here we go: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# -*- coding: utf-8 -*-&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# ---------------------------------------------------------------------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# my.py&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Created on: 2014-03-06 11:38:22.00000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#&amp;nbsp;&amp;nbsp; (generated by ArcGIS/ModelBuilder)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Usage: my &amp;lt;Z_value_field&amp;gt; &amp;lt;Input_features&amp;gt; &amp;lt;Output_cell_size&amp;gt; &amp;lt;Output_raster&amp;gt; &amp;lt;Input_absolute_barrier_features&amp;gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# Description: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;# ---------------------------------------------------------------------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Import arcpy module&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Check out any necessary licenses&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.CheckOutExtension("GeoStats")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Set Geoprocessing environments&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.outputCoordinateSystem = "PROJCS['NAD_1983_StatePlane_Massachusetts_Mainland_FIPS_2001',GEOGCS['GCS_North_American_1983',DATUM['D_North_American_1983',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Lambert_Conformal_Conic'],PARAMETER['False_Easting',200000.0],PARAMETER['False_Northing',750000.0],PARAMETER['Central_Meridian',-71.5],PARAMETER['Standard_Parallel_1',41.71666666666667],PARAMETER['Standard_Parallel_2',42.68333333333333],PARAMETER['Latitude_Of_Origin',41.0],UNIT['Meter',1.0]]"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.extent = "228036.127400003 885223.3233 272353.924400003 922000.4802"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.env.mask = "presentaiton_area_mask"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Script arguments&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Z_value_field = arcpy.GetParameterAsText(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Input_features = arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Output_cell_size = arcpy.GetParameterAsText(2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if Output_cell_size == '#' or not Output_cell_size:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Output_cell_size = "147.1086276" # provide a default value if unspecified&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Output_raster = arcpy.GetParameterAsText(3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Input_absolute_barrier_features = arcpy.GetParameterAsText(4)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Local variables:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Output_geostatistical_layer = Input_features&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Kernel Interpolation With Barriers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.KernelInterpolationWithBarriers_ga(Input_features, Z_value_field, Output_geostatistical_layer, Output_raster, Output_cell_size, Input_absolute_barrier_features, "POLYNOMIAL5", "2000", "1", "50", "PREDICTION")&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Mar 2014 15:41:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-geostatistical-analyst-questions/running-python-script-that-is-exported-from-model/m-p/194031#M489</guid>
      <dc:creator>yanma</dc:creator>
      <dc:date>2014-03-06T15:41:48Z</dc:date>
    </item>
    <item>
      <title>lajm-shqip</title>
      <link>https://community.esri.com/t5/arcgis-geostatistical-analyst-questions/running-python-script-that-is-exported-from-model/m-p/194032#M490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;A href="http://www.lajm-shqip.com/"&gt;http://www.lajm-shqip.com/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Mar 2014 15:46:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-geostatistical-analyst-questions/running-python-script-that-is-exported-from-model/m-p/194032#M490</guid>
      <dc:creator>lajmshqip</dc:creator>
      <dc:date>2014-03-06T15:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: Running Python script that is exported from model builder</title>
      <link>https://community.esri.com/t5/arcgis-geostatistical-analyst-questions/running-python-script-that-is-exported-from-model/m-p/194033#M491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can you try hard-coding the values in the script and see if that works?&amp;nbsp; Also when hard-coding the values, just run the script through IDLE.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Mar 2014 15:49:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-geostatistical-analyst-questions/running-python-script-that-is-exported-from-model/m-p/194033#M491</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2014-03-06T15:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: Running Python script that is exported from model builder</title>
      <link>https://community.esri.com/t5/arcgis-geostatistical-analyst-questions/running-python-script-that-is-exported-from-model/m-p/194034#M492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm not a Python expert, but I think the problem is in this line:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;Output_geostatistical_layer = Input_features&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You're giving the output geostatistical layer the same name as the input features.&amp;nbsp; Try giving it a unique name or expose it as a parameter in your script tool.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Mar 2014 16:50:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-geostatistical-analyst-questions/running-python-script-that-is-exported-from-model/m-p/194034#M492</guid>
      <dc:creator>EricKrause</dc:creator>
      <dc:date>2014-03-06T16:50:57Z</dc:date>
    </item>
  </channel>
</rss>

