Select to view content in your preferred language

arcpy.da.Describe issues

1087
3
Jump to solution
06-29-2022 04:14 AM
kradijaf
Emerging Contributor

working with DEM, if its a TIN I want to convert it to DEM using Tin to Raster. Problem occures before I get to that part. When finding out what whether inserted DEM is a Raster or a TIN using code below I the decribe function doesn´t work as it should.

 

desc=a.da.Describe(r'%s' %sys.argv[2])
if desc.datasetType=='TIN':

 

 When sys.argv[2] is a valid raster I get error code below:

 

Traceback (most recent call last):
File "D:\VS\4_semestr\pgis\finale\spadovani_toku3_kradijan_seider.py", line 56, in <module>
if desc.datasetType=='TIN':
AttributeError: 'dict' object has no attribute 'datasetType'

Need a way to check the datasetType, using ArcGIS Pro 2.9 with Python 3.7.11

0 Kudos
1 Solution

Accepted Solutions
Luke_Pinner
MVP Regular Contributor

You are mixing up old style arcpy.Describe with arcpy.da.Describe

arcpy.da.Describe returns a dictionary, use desc["datasetType"] instead.

 

 

View solution in original post

3 Replies
DanPatterson
MVP Esteemed Contributor
desc=a.da.Describe("{}".format(sys.argv[2]))

assuming 'a' is arcpy


... sort of retired...
kradijaf
Emerging Contributor
Yes, a = arcpy
0 Kudos
Luke_Pinner
MVP Regular Contributor

You are mixing up old style arcpy.Describe with arcpy.da.Describe

arcpy.da.Describe returns a dictionary, use desc["datasetType"] instead.