<?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 GetParameterAsText throws 'function' object is not subscriptable in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/getparameterastext-throws-function-object-is-not/m-p/1054045#M61017</link>
    <description>&lt;P&gt;I have a script that I am adding into a model builder model. When I run the script without parameters, it runs fine. When I run it within the model with a parameter, it gives the error:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "E:\LiDar_experiments\culvertElevation.py", line 14, in &amp;lt;module&amp;gt;&lt;BR /&gt;culverts = arcpy.GetParameterAsText[0]&lt;BR /&gt;TypeError: 'function' object is not subscriptable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;culverts = arcpy.GetParameterAsText[0]
DEM = arcpy.GetParameterAsText[1]
outpath = arcpy.GetParameterAsText[2]

arcpy.management.FeatureVerticesToPoints(culverts, os.path.join(outpath,"culverts_start"), "START")
arcpy.management.FeatureVerticesToPoints(culverts, os.path.join(outpath,"culverts_end"), "END")
arcpy.sa.ExtractValuesToPoints("culverts_start", DEM, os.path.join(outpath,"culverts_start_elevation"), "NONE", "VALUE_ONLY")
arcpy.sa.ExtractValuesToPoints("culverts_end", DEM, os.path.join(outpath,"culverts_end_elevation"), "NONE", "VALUE_ONLY")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 03 May 2021 23:43:49 GMT</pubDate>
    <dc:creator>KathleenHoenke</dc:creator>
    <dc:date>2021-05-03T23:43:49Z</dc:date>
    <item>
      <title>GetParameterAsText throws 'function' object is not subscriptable</title>
      <link>https://community.esri.com/t5/python-questions/getparameterastext-throws-function-object-is-not/m-p/1054045#M61017</link>
      <description>&lt;P&gt;I have a script that I am adding into a model builder model. When I run the script without parameters, it runs fine. When I run it within the model with a parameter, it gives the error:&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;BR /&gt;File "E:\LiDar_experiments\culvertElevation.py", line 14, in &amp;lt;module&amp;gt;&lt;BR /&gt;culverts = arcpy.GetParameterAsText[0]&lt;BR /&gt;TypeError: 'function' object is not subscriptable&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;culverts = arcpy.GetParameterAsText[0]
DEM = arcpy.GetParameterAsText[1]
outpath = arcpy.GetParameterAsText[2]

arcpy.management.FeatureVerticesToPoints(culverts, os.path.join(outpath,"culverts_start"), "START")
arcpy.management.FeatureVerticesToPoints(culverts, os.path.join(outpath,"culverts_end"), "END")
arcpy.sa.ExtractValuesToPoints("culverts_start", DEM, os.path.join(outpath,"culverts_start_elevation"), "NONE", "VALUE_ONLY")
arcpy.sa.ExtractValuesToPoints("culverts_end", DEM, os.path.join(outpath,"culverts_end_elevation"), "NONE", "VALUE_ONLY")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 May 2021 23:43:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getparameterastext-throws-function-object-is-not/m-p/1054045#M61017</guid>
      <dc:creator>KathleenHoenke</dc:creator>
      <dc:date>2021-05-03T23:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: GetParameterAsText throws 'function' object is not subscriptable</title>
      <link>https://community.esri.com/t5/python-questions/getparameterastext-throws-function-object-is-not/m-p/1054055#M61018</link>
      <description>&lt;P&gt;( ) not [ ]&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/functions/getparameterastext.htm" target="_blank" rel="noopener"&gt;GetParameterAsText—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;round brackets&lt;/P&gt;&lt;P&gt;culverts = arcpy.&lt;STRIKE&gt;GetParameterAsText[0]&lt;/STRIKE&gt;&amp;nbsp; # no&lt;/P&gt;&lt;P&gt;culverts = arcpy.GetParameterAsText(0)&amp;nbsp; # yes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In short functions use round brackets.&amp;nbsp; square ones are used when you want to subscript something like a list.&lt;/P&gt;</description>
      <pubDate>Tue, 04 May 2021 09:15:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/getparameterastext-throws-function-object-is-not/m-p/1054055#M61018</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-05-04T09:15:27Z</dc:date>
    </item>
  </channel>
</rss>

