<?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: Problem with script tool parameters (parameter comes in as string when I want flo in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330183#M25692</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; Thanks again.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Jun 2014 20:47:41 GMT</pubDate>
    <dc:creator>AmelieDavis</dc:creator>
    <dc:date>2014-06-10T20:47:41Z</dc:date>
    <item>
      <title>Problem with script tool parameters (parameter comes in as string when I want float)</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330170#M25679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a python script that runs fine stand alone but when I try to make it GUI based by adding it to a toolbox as a script I get errors which I believe are related to how I am setting the parameters.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have three values that I need to be set as a real number with a decimal but they keep coming in as string.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In ArcGIS toolbox, under properties of the model, and the parameters tab, I set those three parameter types to Double (I have also tried String but that doesn't work either).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;then in python, that part of the code looks like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;# -*- coding: utf-8 -*-&amp;nbsp; ############################################################################&amp;nbsp; import sys # Import arcpy module import arcpy #from arcpy import env&amp;nbsp; # Set this to False once testing is complete arcpy.env.overwriteOutput = True&amp;nbsp; ############################################################################ &amp;nbsp;&amp;nbsp;&amp;nbsp; # Script arguments&amp;nbsp; # user defined weights for importance of up to three floral seasons Spring = float(arcpy.GetParameter(3)) arcpy.AddMessage("Floral Weight #1 is equal to: " + str(Spring)) if Spring == '#' or not Spring: &amp;nbsp;&amp;nbsp;&amp;nbsp; Spring = 0.3 # provide a default value if unspecified check1 = arcpy.Parameter(Spring) arcpy.AddMessage("Data type is: " + str(check1.datatype))&amp;nbsp; Summer = float(arcpy.GetParameter(4)) if Summer == '#' or not Summer: &amp;nbsp;&amp;nbsp;&amp;nbsp; Summer = 0.6 # provide a default value if unspecified &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Fall = float(arcpy.GetParameter(5)) if Fall == '#' or not Fall: &amp;nbsp;&amp;nbsp;&amp;nbsp; Fall = 0.1 # provide a default value if unspecified &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Tot = Spring + Summer + Fall arcpy.AddMessage("Floral Weights are equal to: " + str(Tot)) if Tot == 1: &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Sum of floral weights is equal to: " + str(Tot)) else: &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddError("The sum of floral weights must equal to one.") &amp;nbsp;&amp;nbsp;&amp;nbsp; sys.exit() # exit out of model if weights don't add up to 1&amp;nbsp; ############################################################################&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried GetParameter and GetParameterAsText but the value always seems to be coming in as a string.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know this is probably something very basic but I just can't figure it out.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using ArcGIS 10.2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you in advance for any assistance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sincerely,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Amelie&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 15:37:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330170#M25679</guid>
      <dc:creator>AmelieDavis</dc:creator>
      <dc:date>2014-06-10T15:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with script tool parameters (parameter comes in as string when I want flo</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330171#M25680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Amalie, the first thing I'd try out is using GetParameterAsText, that way you are for sure dealing with a string.&amp;nbsp; Then try casting it as a float for a new variable, and print the object type.&amp;nbsp; Something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Spring = arcpy.GetParameterAsText(3) if Spring == '#' or not Spring: &amp;nbsp;&amp;nbsp;&amp;nbsp; Spring = 0.3 # provide a default value if unspecified Spring_float = float(Spring) arcpy.AddMessage(type(Spring))&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;Hopefully that'll work as a good first step.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 17:29:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330171#M25680</guid>
      <dc:creator>AdamCox1</dc:creator>
      <dc:date>2014-06-10T17:29:45Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with script tool parameters (parameter comes in as string when I want flo</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330172#M25681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;For what you're trying to do, you may want to check out the &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00150000000t000000"&gt;Tool Validator class&lt;/A&gt;&lt;SPAN&gt;.&amp;nbsp; Without too much trouble you'd be able to update the updateParameters function to throw a warning/error in the tool interface before your final script is actually run.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 17:34:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330172#M25681</guid>
      <dc:creator>AdamCox1</dc:creator>
      <dc:date>2014-06-10T17:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with script tool parameters (parameter comes in as string when I want flo</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330173#M25682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That does work - sorry.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now I have a float as data type but this doesn't work:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
Tot = Spring + Summer + Fall
arcpy.AddMessage("Floral Weights are equal to: " + str(Tot))
if Tot == 1:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("Sum of floral weights is equal to: " + str(Tot))
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddError("The sum of floral weights must equal to one.")
&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.exit() # exit out of model if weights don't add up to 1
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Amelie&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:38:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330173#M25682</guid>
      <dc:creator>AmelieDavis</dc:creator>
      <dc:date>2021-12-11T15:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with script tool parameters (parameter comes in as string when I want flo</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330174#M25683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well, to be sure you'll have to be more specific about how it doesn't work (is there an error? what error?).&amp;nbsp; Though maybe you just need to have 1.0 instead of 1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was just doing a little testing, and if you have the parameters as Double, you should be able to use GetParameter and the result will be a float object.&amp;nbsp; Also, it looks like having a parameter set as Double will force it to 0 if nothing valid is entered, which would be useful.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 18:12:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330174#M25683</guid>
      <dc:creator>AdamCox1</dc:creator>
      <dc:date>2014-06-10T18:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with script tool parameters (parameter comes in as string when I want flo</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330175#M25684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The way you are checking the type is incorrect. arcpy.Parameter(x) will create a new Parameter object, not provide information about the parameter itself. Therefore check1.datatype will always default to String, since it is the default data type of a new Parameter object. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Assuming your parameters are set like this in the script - &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;[ATTACH=CONFIG]34484[/ATTACH]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;test = arcpy.GetParameter(0)
arcpy.AddMessage(type(test))&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Should return &amp;lt;type 'float'&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can use these in conditionals like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;if type(1.0) == float: print "true"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, its worth mentioning '#' in a double parameter field will actually return 0, not the '#' character.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:38:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330175#M25684</guid>
      <dc:creator>ClintDow</dc:creator>
      <dc:date>2021-12-11T15:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with script tool parameters (parameter comes in as string when I want flo</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330176#M25685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry, it's not an error it's just not what I would expect.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've changed "if Tot == 1" to "if Tot == 1.0"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If in the tool GUI I set Spring = 1, Summer = 0, and Fall = 0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then I go into the if statement and the rest of the script runs (i get the "Sum of floral weights is equal to: 1.0 message).&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is what I would expect.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;BUT if in the tool GUI I set Spring = 0.6, Summer = 0.3, and Fall = 0.1,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then I go into the else statement and the tool stops running even though I've added a "catch message" (arcpy.AddError("The sum of floral weights must equal to one, but it is equal to " + str(Tot))) and it tells me that Tot is equal to 1.0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What do you think?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Amelie&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 18:37:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330176#M25685</guid>
      <dc:creator>AmelieDavis</dc:creator>
      <dc:date>2014-06-10T18:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with script tool parameters (parameter comes in as string when I want flo</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330177#M25686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try out&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;if str(Tot) == "1.0"&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;It seems like it's just a type issue, so the best thing to do is just keep adding a bunch of messages and type-checking.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 18:44:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330177#M25686</guid>
      <dc:creator>AdamCox1</dc:creator>
      <dc:date>2014-06-10T18:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with script tool parameters (parameter comes in as string when I want flo</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330178#M25687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;this is utterly bizarre.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried &lt;/SPAN&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;if Tot == "1.0":&lt;/PRE&gt;&lt;SPAN&gt; and nothing worked (went into the else loop and sys.exit() ).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So then, I kept the code with &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;if Tot == 1.0:&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and if the values for Spring, Summer, and Fall in the GUI are set to 0.2,0.6,0.2, respectively program runs completely&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So does 0.4, 0.6, 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This works too 0.6, 0, 0.4&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but not 0.6, 0.3, 0.1 (it goes into the else loop and does sys.exit() ).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm tearing my hair out.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 18:59:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330178#M25687</guid>
      <dc:creator>AmelieDavis</dc:creator>
      <dc:date>2014-06-10T18:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with script tool parameters (parameter comes in as string when I want flo</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330179#M25688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, that makes no sense.&amp;nbsp; It's a very simple operation, so I bet it has to do with something silly.&amp;nbsp; I just made three Double parameters, and the following code works perfectly:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy

a = arcpy.GetParameter(0)
b = arcpy.GetParameter(1)
c = arcpy.GetParameter(2)

total = a + b + c
arcpy.AddMessage(total)
if total == 1.0:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("&amp;nbsp; all good")
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("&amp;nbsp; all not good")
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;I think you should scale it back to something simple like that.&amp;nbsp; If you set the parameters as required in the tool properties, the user will not be able to run it without entering something, and with Double parameters, if they enter something that is nonsense, like a letter, the parameter will automatically set to 0.&amp;nbsp; Start from scratch and this should work fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Be gentle on the hair.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:38:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330179#M25688</guid>
      <dc:creator>AdamCox1</dc:creator>
      <dc:date>2021-12-11T15:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with script tool parameters (parameter comes in as string when I want flo</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330180#M25689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Must be some setting on my computer.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Still get the same problem:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Executing: Script1 0.6 0.3 0.1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Start Time: Tue Jun 10 17:00:52 2014&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Running script Script1...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; all NOT good&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Completed script Script1...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Succeeded at Tue Jun 10 17:00:52 2014 (Elapsed Time: 0.01 seconds)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;These are the only lines of code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy

a = arcpy.GetParameter(0)
b = arcpy.GetParameter(1)
c = arcpy.GetParameter(2)

total = a + b + c
arcpy.AddMessage(total)
if total == 1.0:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("&amp;nbsp; all good")
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("&amp;nbsp; all NOT good")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I only have three parameters and they are all set up to Double.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;yet the 0.6, 0.4, 0.1 combo doesn't work&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;it works in yours?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:38:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330180#M25689</guid>
      <dc:creator>AmelieDavis</dc:creator>
      <dc:date>2021-12-11T15:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with script tool parameters (parameter comes in as string when I want flo</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330181#M25690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;OMG!! &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Check this out: &lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://www.exploringbinary.com/why-0-point-1-does-not-exist-in-floating-point/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.exploringbinary.com/why-0-point-1-does-not-exist-in-floating-point/&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html" rel="nofollow noopener noreferrer" target="_blank"&gt;http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Armed with this knowledge, I changed the code to this: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
import arcpy

a = arcpy.GetParameter(0)
b = arcpy.GetParameter(1)
c = arcpy.GetParameter(2)

total = ((a * 100) + (b * 100) + (c * 100))
arcpy.AddMessage(total)
if total == 100:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("&amp;nbsp; all good")
else:
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.AddMessage("&amp;nbsp; all NOT good")
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And now it works!!! yay!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My hair stylist thanks you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;No, seriously though, THANK YOU for helping me work this out.&amp;nbsp; I thought I was going crazy.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Amelie&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:38:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330181#M25690</guid>
      <dc:creator>AmelieDavis</dc:creator>
      <dc:date>2021-12-11T15:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with script tool parameters (parameter comes in as string when I want flo</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330182#M25691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;OMG is right, that is fascinating.&amp;nbsp; I was just finding that same issue, also with .7, .2, .1, and also running it as a stand alone script.&amp;nbsp; Was thinking of how it's weird that it's only a problem when .1 is the last digit, and when there is only one .1 value.&amp;nbsp; Was thinking we may need to turn to stack overflow...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Well, nice work, and that looks like a good work-around.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 20:34:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330182#M25691</guid>
      <dc:creator>AdamCox1</dc:creator>
      <dc:date>2014-06-10T20:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with script tool parameters (parameter comes in as string when I want flo</title>
      <link>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330183#M25692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; Thanks again.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 20:47:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/problem-with-script-tool-parameters-parameter/m-p/330183#M25692</guid>
      <dc:creator>AmelieDavis</dc:creator>
      <dc:date>2014-06-10T20:47:41Z</dc:date>
    </item>
  </channel>
</rss>

