<?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 Error in getting parameter as text in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/error-in-getting-parameter-as-text/m-p/396422#M31294</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear sir &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I&amp;nbsp; try to run a python script. I cant get the parameter as text. the following error message is display when it run&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This parameter is save from the calender.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "J:\Gampaha\Scripts\Creating_Building_New.py", line 13, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; VDate = arcpy.GetParameterAsText(4)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\__init__.py", line 592, in GetParameterAsText&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return gp.getParameterAsText(index)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\geoprocessing\_base.py", line 224, in getParameterAsText&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; self._gp.GetParameterAsText(*gp_fixargs(args, True)))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RuntimeError: Object: Error in getting parameter as text&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;Padmasiri&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 May 2014 09:19:44 GMT</pubDate>
    <dc:creator>H_A_D_Padmasiri</dc:creator>
    <dc:date>2014-05-09T09:19:44Z</dc:date>
    <item>
      <title>Error in getting parameter as text</title>
      <link>https://community.esri.com/t5/python-questions/error-in-getting-parameter-as-text/m-p/396422#M31294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Dear sir &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I&amp;nbsp; try to run a python script. I cant get the parameter as text. the following error message is display when it run&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This parameter is save from the calender.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Traceback (most recent call last):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "J:\Gampaha\Scripts\Creating_Building_New.py", line 13, in &amp;lt;module&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; VDate = arcpy.GetParameterAsText(4)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\__init__.py", line 592, in GetParameterAsText&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return gp.getParameterAsText(index)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\geoprocessing\_base.py", line 224, in getParameterAsText&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; self._gp.GetParameterAsText(*gp_fixargs(args, True)))&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RuntimeError: Object: Error in getting parameter as text&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;Padmasiri&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 09:19:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-in-getting-parameter-as-text/m-p/396422#M31294</guid>
      <dc:creator>H_A_D_Padmasiri</dc:creator>
      <dc:date>2014-05-09T09:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Error in getting parameter as text</title>
      <link>https://community.esri.com/t5/python-questions/error-in-getting-parameter-as-text/m-p/396423#M31295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello Padmasiri,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank seems strange. One suggestion, are you starting your list at 0? As in &lt;/SPAN&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;arcpy.GetParameterAsText(0)&lt;/SPAN&gt;&lt;SPAN&gt; is the first text input and &lt;/SPAN&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;arcpy.GetParameterAsText(4)&lt;/SPAN&gt;&lt;SPAN&gt; would be the fifth. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Alternatively you can try using &lt;/SPAN&gt;&lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;sys.argv[]&lt;/SPAN&gt;&lt;SPAN&gt;. It would look something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import sys

input1=sys.argv[1] #Note that the list starts at 1 because sys.argv[0] stores the location of the current script.
input2=sys.argv[2]
input3=sys.argv[3]
input4=sys.argv[4]
input5=sys.argv[5] #the fifth input to the tool. Same as arcpy.GetParameterAsText(4)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Good luck!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:08:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-in-getting-parameter-as-text/m-p/396423#M31295</guid>
      <dc:creator>JoshuaChisholm</dc:creator>
      <dc:date>2021-12-11T18:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: Error in getting parameter as text</title>
      <link>https://community.esri.com/t5/python-questions/error-in-getting-parameter-as-text/m-p/396424#M31296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hello Padmasiri,&lt;BR /&gt;&lt;BR /&gt;Thank seems strange. One suggestion, are you starting your list at 0? As in &lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;arcpy.GetParameterAsText(0)&lt;/SPAN&gt; is the first text input and &lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;arcpy.GetParameterAsText(4)&lt;/SPAN&gt; would be the fifth. &lt;BR /&gt;&lt;BR /&gt;Alternatively you can try using &lt;SPAN style="font-style: italic; text-decoration: underline;"&gt;sys.argv[]&lt;/SPAN&gt;. It would look something like this:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import sys

input1=sys.argv[1] #Note that the list starts at 1 because sys.argv[0] stores the location of the current script.
input2=sys.argv[2]
input3=sys.argv[3]
input4=sys.argv[4]
input5=sys.argv[5] #the fifth input to the tool. Same as arcpy.GetParameterAsText(4)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Good luck!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dear sir&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much for your answer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It run correctly when I amend according to you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks again&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Padmasiri&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:08:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/error-in-getting-parameter-as-text/m-p/396424#M31296</guid>
      <dc:creator>H_A_D_Padmasiri</dc:creator>
      <dc:date>2021-12-11T18:08:15Z</dc:date>
    </item>
  </channel>
</rss>

