<?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 Script Tool Working but not working correctly in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/script-tool-working-but-not-working-correctly/m-p/219193#M16873</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am a little confused on why my script tool is not working. I run it and it finishes with no issues but nothing happens. I have even tried to simplify it down and the same thing happens (runs and finishes with no errors but doesn't complete its task)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The tool is a simple add field and then clip to an area. Please help I am trying to get this code to work for a class project as an add on component.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import arcpy
from arcpy import env

try:

#Functions
&amp;nbsp;&amp;nbsp;&amp;nbsp; inTest = arcpy.GetParameterAsText(0)&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; clipArea = arcpy.GetParameterAsText(1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; outFeature = arcpy.GetParameterAsText(2)

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = "S:/TallPinesGIS/Data"

# Add Field to Polygon for ranking
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Addmessage('Adding Fields')
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management("inTest","TEST","SHORT","2","#","#","#","NON_NULLABLE","NON_REQUIRED","#")
# Clip Features to current Project Area
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Addmessage('Clipping features outside of project area')
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Clip_analysis("inTest","clipArea","outFeature","#")

except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages() 
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Dec 2011 15:48:11 GMT</pubDate>
    <dc:creator>ChrisBrannin</dc:creator>
    <dc:date>2011-12-12T15:48:11Z</dc:date>
    <item>
      <title>Script Tool Working but not working correctly</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-working-but-not-working-correctly/m-p/219193#M16873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am a little confused on why my script tool is not working. I run it and it finishes with no issues but nothing happens. I have even tried to simplify it down and the same thing happens (runs and finishes with no errors but doesn't complete its task)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The tool is a simple add field and then clip to an area. Please help I am trying to get this code to work for a class project as an add on component.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
import arcpy
from arcpy import env

try:

#Functions
&amp;nbsp;&amp;nbsp;&amp;nbsp; inTest = arcpy.GetParameterAsText(0)&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; clipArea = arcpy.GetParameterAsText(1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; outFeature = arcpy.GetParameterAsText(2)

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = "S:/TallPinesGIS/Data"

# Add Field to Polygon for ranking
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Addmessage('Adding Fields')
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management("inTest","TEST","SHORT","2","#","#","#","NON_NULLABLE","NON_REQUIRED","#")
# Clip Features to current Project Area
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Addmessage('Clipping features outside of project area')
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Clip_analysis("inTest","clipArea","outFeature","#")

except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages() 
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Dec 2011 15:48:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-working-but-not-working-correctly/m-p/219193#M16873</guid>
      <dc:creator>ChrisBrannin</dc:creator>
      <dc:date>2011-12-12T15:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: Script Tool Working but not working correctly</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-working-but-not-working-correctly/m-p/219194#M16874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You need to unquote your variables. Try this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
from arcpy import env

try:

#Functions
&amp;nbsp;&amp;nbsp;&amp;nbsp; inTest = arcpy.GetParameterAsText(0)&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; clipArea = arcpy.GetParameterAsText(1)
&amp;nbsp;&amp;nbsp;&amp;nbsp; outFeature = arcpy.GetParameterAsText(2)

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.env.workspace = "S:/TallPinesGIS/Data"

# Add Field to Polygon for ranking
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Addmessage('Adding Fields')
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddField_management(inTest,"TEST","SHORT","2","#","#","#","NON_NULLABLE","NON_REQUIRED","#")
# Clip Features to current Project Area
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Addmessage('Clipping features outside of project area')
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Clip_analysis(inTest,clipArea,outFeature,"#")

except:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:41:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-working-but-not-working-correctly/m-p/219194#M16874</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2021-12-11T10:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: Script Tool Working but not working correctly</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-working-but-not-working-correctly/m-p/219195#M16875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You're variables cannot use quotes as this would indicate a string instead of the variable you are trying to pass.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;inTest != "inTest"&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Dec 2011 15:52:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-working-but-not-working-correctly/m-p/219195#M16875</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2011-12-12T15:52:44Z</dc:date>
    </item>
    <item>
      <title>Re: Script Tool Working but not working correctly</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-working-but-not-working-correctly/m-p/219196#M16876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank you for the responses! I ran it again and got the same results. I aslo realized that I was testing it with .shp and thought that I would need to use &lt;/SPAN&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;inTest = arcpy.MakeFeatureLayer_management(inTest)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but am still getting the same results for that as well.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Dec 2011 16:42:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-working-but-not-working-correctly/m-p/219196#M16876</guid>
      <dc:creator>ChrisBrannin</dc:creator>
      <dc:date>2011-12-12T16:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: Script Tool Working but not working correctly</title>
      <link>https://community.esri.com/t5/python-questions/script-tool-working-but-not-working-correctly/m-p/219197#M16877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Got it! I took out the try: &amp;amp; except: and noticed that the AddMessage was Addmessage. Works like a charm now! Thanks again for all the help!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Dec 2011 17:06:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/script-tool-working-but-not-working-correctly/m-p/219197#M16877</guid>
      <dc:creator>ChrisBrannin</dc:creator>
      <dc:date>2011-12-12T17:06:13Z</dc:date>
    </item>
  </channel>
</rss>

