<?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: Modifying Python script to work in a toolbox in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/modifying-python-script-to-work-in-a-toolbox/m-p/73268#M5991</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;"E:\User\MillageCode"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;shouldn't work, you need \\ instead of \ or append r to the front of the path&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Jul 2013 18:32:58 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2013-07-15T18:32:58Z</dc:date>
    <item>
      <title>Modifying Python script to work in a toolbox</title>
      <link>https://community.esri.com/t5/python-questions/modifying-python-script-to-work-in-a-toolbox/m-p/73267#M5990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am new to python scripting and began by creating a specific tool.&amp;nbsp; The clip works well in either PythonWin 2.7 or ArcToolbox 10.1. Now, I want to modify the script for any feature class. How would I modify the script to input/clip/output any feature class? GetParameterAsText? Then, I intend to add the script to a toolbox. The script is as follows:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;#Import system modules&lt;BR /&gt; import arcpy&lt;BR /&gt; from arcpy import env&lt;BR /&gt; &lt;BR /&gt;#Workspace&lt;BR /&gt; env.workspace = "E:\User\MillageCode"&lt;BR /&gt; &lt;BR /&gt;#Variables&lt;BR /&gt; input = "Sales_2006.shp"&lt;BR /&gt; clip = "EagleHarborSales_temp.shp"&lt;BR /&gt; output = "Output_temp5.shp"&lt;BR /&gt; &lt;BR /&gt;#Clip the Sales_2006 shapefile to the EagleHarborSales_temp shapefile&lt;BR /&gt; arcpy.Clip_analysis(input, clip, output)&lt;BR /&gt; &lt;BR /&gt;#Info &lt;BR /&gt; print arcpy.GetMessages()&lt;/BLOCKQUOTE&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, I have modified the Python script to include the GetParameterAsText function.&amp;nbsp; But, I receive an error code that statues values are not defined for the input, clip, and output.&amp;nbsp; The code now reads:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;#Import modules&lt;BR /&gt;import arcpy, os, sys&lt;BR /&gt;from arcpy import env&lt;BR /&gt;&lt;BR /&gt;#Workspace&lt;BR /&gt;arcpy.env.workspace = arcpy.GetParameterAsText(0)&lt;BR /&gt;&lt;BR /&gt;#Variables&lt;BR /&gt;input = arcpy.GetParameterAsText(1)&lt;BR /&gt;clip = arcpy.GetParameterAsText(2)&lt;BR /&gt;output = arcpy.GetParameterAsText(3)&lt;BR /&gt;&lt;BR /&gt;#Clip&lt;BR /&gt;arcpy.Clip_analysis(input, clip, output)&lt;BR /&gt;&lt;BR /&gt;#Info&lt;BR /&gt;print arcpy.GetMessages()&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions on why the script errors out?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jul 2013 17:00:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/modifying-python-script-to-work-in-a-toolbox/m-p/73267#M5990</guid>
      <dc:creator>JacobDrvar</dc:creator>
      <dc:date>2013-07-15T17:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying Python script to work in a toolbox</title>
      <link>https://community.esri.com/t5/python-questions/modifying-python-script-to-work-in-a-toolbox/m-p/73268#M5991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;"E:\User\MillageCode"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;shouldn't work, you need \\ instead of \ or append r to the front of the path&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jul 2013 18:32:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/modifying-python-script-to-work-in-a-toolbox/m-p/73268#M5991</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2013-07-15T18:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying Python script to work in a toolbox</title>
      <link>https://community.esri.com/t5/python-questions/modifying-python-script-to-work-in-a-toolbox/m-p/73269#M5992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;"E:\User\MillageCode"&lt;BR /&gt;&lt;BR /&gt;shouldn't work, you need \\ instead of \ or append r to the front of the path&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The E:\User\MillageCode path works in both ArcToolbox and PythonWin.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions on the second script?&amp;nbsp; The error is an ExecuteError: Failed to execute.&amp;nbsp; Parameters are not valid.&amp;nbsp; Error 000735: Input, Clip, and Output Features: Value is required.&amp;nbsp; I thought the values were provided as variables.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jul 2013 18:38:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/modifying-python-script-to-work-in-a-toolbox/m-p/73269#M5992</guid>
      <dc:creator>JacobDrvar</dc:creator>
      <dc:date>2013-07-15T18:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying Python script to work in a toolbox</title>
      <link>https://community.esri.com/t5/python-questions/modifying-python-script-to-work-in-a-toolbox/m-p/73270#M5993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;print the inputs and outputs to see if what you suggests does indeed work&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jul 2013 19:37:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/modifying-python-script-to-work-in-a-toolbox/m-p/73270#M5993</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2013-07-15T19:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying Python script to work in a toolbox</title>
      <link>https://community.esri.com/t5/python-questions/modifying-python-script-to-work-in-a-toolbox/m-p/73271#M5994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dan,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The desired results were achieved through the first script.&amp;nbsp; I loaded the output shapefile created in Python vs. running the clip tool in ArcToolbox.&amp;nbsp; The results were identical.&amp;nbsp; I just NEED to get the second script up and running.&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a copy of the results from the Interactive Window.&amp;nbsp; I just reran the first script.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Executing: Clip E:\User\MillageCode\Sales_2006.shp E:\User\MillageCode\EagleHarborSales_temp.shp E:\User\MillageCode\Output_temp5.shp #&lt;BR /&gt;Start Time: Tue Jul 16 07:35:46 2013&lt;BR /&gt;Reading Features...&lt;BR /&gt;Cracking Features...&lt;BR /&gt;Assembling Features...&lt;BR /&gt;Succeeded at Tue Jul 16 07:35:46 2013 (Elapsed Time: 0.00 seconds)&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jul 2013 10:41:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/modifying-python-script-to-work-in-a-toolbox/m-p/73271#M5994</guid>
      <dc:creator>JacobDrvar</dc:creator>
      <dc:date>2013-07-16T10:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Modifying Python script to work in a toolbox</title>
      <link>https://community.esri.com/t5/python-questions/modifying-python-script-to-work-in-a-toolbox/m-p/73272#M5995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Are you supplying the script with the requested parameters? In PythonWin there is a place to put in the parameters(Arguments). In toolbox you will have to create the parameters.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jul 2013 15:30:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/modifying-python-script-to-work-in-a-toolbox/m-p/73272#M5995</guid>
      <dc:creator>WesMiller</dc:creator>
      <dc:date>2013-07-16T15:30:18Z</dc:date>
    </item>
  </channel>
</rss>

