<?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: imported parameters disappear while running script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/imported-parameters-disappear-while-running-script/m-p/79718#M6427</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the tip and sample code... &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I do store every return in a variable, but in the first go of the 'while' loop my script needs to reset one of the variables to an empty string, whereas it needs to have the original input for the second go. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I thought the passed arguments to arcpy.GetParameterAsText() would persist all through the script (I've tried it with shorter version of the script - including the while loop - and that seems to work).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any more ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Dec 2011 20:53:12 GMT</pubDate>
    <dc:creator>MaartenHofman1</dc:creator>
    <dc:date>2011-12-19T20:53:12Z</dc:date>
    <item>
      <title>imported parameters disappear while running script</title>
      <link>https://community.esri.com/t5/python-questions/imported-parameters-disappear-while-running-script/m-p/79716#M6425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm running a script for a toolbox, and I get the parameters for it using arcpy.GetParameterAsText(). &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It gets the parameters without problems, but in the second go of a while loop (without cursors), it seems that I cannot use the same arcpy.GetParameterAsText() to define a new variable. It just returns an empty string... what happened to the parameters I entered? Anyone has had similar problem?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Maarten&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Dec 2011 16:42:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/imported-parameters-disappear-while-running-script/m-p/79716#M6425</guid>
      <dc:creator>MaartenHofman1</dc:creator>
      <dc:date>2011-12-19T16:42:53Z</dc:date>
    </item>
    <item>
      <title>Re: imported parameters disappear while running script</title>
      <link>https://community.esri.com/t5/python-questions/imported-parameters-disappear-while-running-script/m-p/79717#M6426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It is better practice to store the return value from a function/method in a variable if you are going to use it more than once rather than repeatedly calling the function method.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;param1=arcpy.GetParameterAsText(1)
for i in range(10):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if i &amp;gt;=param1: #eg use a variable instead of calling GetParameterAsText 10x
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dosomething()
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:04:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/imported-parameters-disappear-while-running-script/m-p/79717#M6426</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2021-12-10T23:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: imported parameters disappear while running script</title>
      <link>https://community.esri.com/t5/python-questions/imported-parameters-disappear-while-running-script/m-p/79718#M6427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the tip and sample code... &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I do store every return in a variable, but in the first go of the 'while' loop my script needs to reset one of the variables to an empty string, whereas it needs to have the original input for the second go. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I thought the passed arguments to arcpy.GetParameterAsText() would persist all through the script (I've tried it with shorter version of the script - including the while loop - and that seems to work).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Any more ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Dec 2011 20:53:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/imported-parameters-disappear-while-running-script/m-p/79718#M6427</guid>
      <dc:creator>MaartenHofman1</dc:creator>
      <dc:date>2011-12-19T20:53:12Z</dc:date>
    </item>
    <item>
      <title>Re: imported parameters disappear while running script</title>
      <link>https://community.esri.com/t5/python-questions/imported-parameters-disappear-while-running-script/m-p/79719#M6428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks for the tip and sample code... &lt;BR /&gt;I do store every return in a variable, but in the first go of the 'while' loop my script needs to reset one of the variables to an empty string, whereas it needs to have the original input for the second go. &lt;BR /&gt;I thought the passed arguments to arcpy.GetParameterAsText() would persist all through the script (I've tried it with shorter version of the script - including the while loop - and that seems to work).&lt;BR /&gt;Any more ideas?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It's possible that if you run another tool in the script that's going to reset the parameter vector. I agree that capturing the information in one section of your script - once - is much safer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A thing to consider is whether there is something in your tool that lends it self to parameter validation code.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Dec 2011 22:19:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/imported-parameters-disappear-while-running-script/m-p/79719#M6428</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2011-12-19T22:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: imported parameters disappear while running script</title>
      <link>https://community.esri.com/t5/python-questions/imported-parameters-disappear-while-running-script/m-p/79720#M6429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just make two copies of the parameter variable. &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;gt;&amp;gt;&amp;gt; param1a=param1b=arcpy.GetParameterAsText(1)
&amp;gt;&amp;gt;&amp;gt; print param1a
Some Parameter
&amp;gt;&amp;gt;&amp;gt; print param1b
Some Parameter
&amp;gt;&amp;gt;&amp;gt; print param1a==param1b
True
&amp;gt;&amp;gt;&amp;gt; param1a='Something else'
&amp;gt;&amp;gt;&amp;gt; print param1a==param1b
False&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:04:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/imported-parameters-disappear-while-running-script/m-p/79720#M6429</guid>
      <dc:creator>Luke_Pinner</dc:creator>
      <dc:date>2021-12-10T23:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: imported parameters disappear while running script</title>
      <link>https://community.esri.com/t5/python-questions/imported-parameters-disappear-while-running-script/m-p/79721#M6430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ok, I figured that I could just define two variables from the same input, but it still strikes me as odd that it has to work like that... Anyways, thanks for your suggestions!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Dec 2011 18:21:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/imported-parameters-disappear-while-running-script/m-p/79721#M6430</guid>
      <dc:creator>MaartenHofman1</dc:creator>
      <dc:date>2011-12-20T18:21:09Z</dc:date>
    </item>
  </channel>
</rss>

