<?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 Arcpy describe().shapeType - interpreter problems in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/arcpy-describe-shapetype-interpreter-problems/m-p/349858#M12153</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi All, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I just migrated from Arc 9.3.1 to Arc 10, and now I'm re-writing my scripts to go along. Something a bit odd, though; in the python console within arc I can get this code to run fine: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
searchPath = os.path.abspath(arcpy.GetParameterAsText(0)) #path to search

for root, dirs, files in os.walk(searchPath):
&amp;nbsp;&amp;nbsp;&amp;nbsp; for f in files:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if fnmatch.fnmatch(f, searchParam):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shpType = arcpy.Describe(os.path.join(root, f)).shapeType
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if str(shpType) == "Polyline":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "blah blah"

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, when running from within a model, the python interpreter is getting hung up on shapeType, claiming:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;DescribeData: Method shapeType does not exist&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas on this?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Matt&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Full code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# Import system modules
import sys, string, os, fnmatch, arcpy

# Get variables from the ArcGUI *must setup the tool properly in Arc*
searchPath = os.path.abspath(arcpy.GetParameterAsText(0)) #path to search
searchParam = arcpy.GetParameterAsText(1) #search paramater - wildcards OK
shapefileType = arcpy.GetParameterAsText(2) #shapefile type: Polyline, Polygon, Point, etc.

# Search function
resultList = [] #The list for collecting results with...
resultString = "" #Blank the results from previous searches
outFilesMV = "" #Blank the results from previous searches
for root, dirs, files in os.walk(searchPath):
 for f in files:
&amp;nbsp; if fnmatch.fnmatch(f, searchParam):
&amp;nbsp;&amp;nbsp; shpType = arcpy.Describe(os.path.join(root, f)).shapeType
&amp;nbsp;&amp;nbsp; if str(shpType) == shapefileType:
&amp;nbsp;&amp;nbsp;&amp;nbsp; tempString = "'" + os.path.join(root, f) + "'"
&amp;nbsp;&amp;nbsp;&amp;nbsp; resultList.append(tempString)
&amp;nbsp;&amp;nbsp;&amp;nbsp; resultList.append(";")
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
resultList.pop() #removes last list value (trailing semicolon)
resultString = "\"" + "".join(resultList) + "\"" #Convert list to a single string
outFilesMV = resultString.replace("\\","\\\\")

# set Arc output:
arcpy.SetParameterAsText(3, outFilesMV)
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 16:27:14 GMT</pubDate>
    <dc:creator>MattRosales</dc:creator>
    <dc:date>2021-12-11T16:27:14Z</dc:date>
    <item>
      <title>Arcpy describe().shapeType - interpreter problems</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/arcpy-describe-shapetype-interpreter-problems/m-p/349858#M12153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi All, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I just migrated from Arc 9.3.1 to Arc 10, and now I'm re-writing my scripts to go along. Something a bit odd, though; in the python console within arc I can get this code to run fine: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
searchPath = os.path.abspath(arcpy.GetParameterAsText(0)) #path to search

for root, dirs, files in os.walk(searchPath):
&amp;nbsp;&amp;nbsp;&amp;nbsp; for f in files:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if fnmatch.fnmatch(f, searchParam):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shpType = arcpy.Describe(os.path.join(root, f)).shapeType
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if str(shpType) == "Polyline":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "blah blah"

&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, when running from within a model, the python interpreter is getting hung up on shapeType, claiming:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;DescribeData: Method shapeType does not exist&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas on this?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Matt&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Full code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
# Import system modules
import sys, string, os, fnmatch, arcpy

# Get variables from the ArcGUI *must setup the tool properly in Arc*
searchPath = os.path.abspath(arcpy.GetParameterAsText(0)) #path to search
searchParam = arcpy.GetParameterAsText(1) #search paramater - wildcards OK
shapefileType = arcpy.GetParameterAsText(2) #shapefile type: Polyline, Polygon, Point, etc.

# Search function
resultList = [] #The list for collecting results with...
resultString = "" #Blank the results from previous searches
outFilesMV = "" #Blank the results from previous searches
for root, dirs, files in os.walk(searchPath):
 for f in files:
&amp;nbsp; if fnmatch.fnmatch(f, searchParam):
&amp;nbsp;&amp;nbsp; shpType = arcpy.Describe(os.path.join(root, f)).shapeType
&amp;nbsp;&amp;nbsp; if str(shpType) == shapefileType:
&amp;nbsp;&amp;nbsp;&amp;nbsp; tempString = "'" + os.path.join(root, f) + "'"
&amp;nbsp;&amp;nbsp;&amp;nbsp; resultList.append(tempString)
&amp;nbsp;&amp;nbsp;&amp;nbsp; resultList.append(";")
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
resultList.pop() #removes last list value (trailing semicolon)
resultString = "\"" + "".join(resultList) + "\"" #Convert list to a single string
outFilesMV = resultString.replace("\\","\\\\")

# set Arc output:
arcpy.SetParameterAsText(3, outFilesMV)
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:27:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/arcpy-describe-shapetype-interpreter-problems/m-p/349858#M12153</guid>
      <dc:creator>MattRosales</dc:creator>
      <dc:date>2021-12-11T16:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy describe().shapeType - interpreter problems</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/arcpy-describe-shapetype-interpreter-problems/m-p/349859#M12154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Update - this problem originated by trying to describe() a non-shapefile. The search parameters should include *.shp to avoid this issue. Oops!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Nov 2010 20:51:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/arcpy-describe-shapetype-interpreter-problems/m-p/349859#M12154</guid>
      <dc:creator>MattRosales</dc:creator>
      <dc:date>2010-11-19T20:51:51Z</dc:date>
    </item>
  </channel>
</rss>

