AttributeError: DescribeData: Method spatialReference does not exist

1854
2
02-20-2016 09:06 AM
RandyBurton
MVP Regular Contributor

I was experimenting with the following code provided on the Prj File properties documentation page using Desktop 10.3.1 and received an attribute error message.  With version 10.2 the code ran without error.

import arcpy
# Create a Describe Object from a prj file.
#
desc = arcpy.Describe("C:\data\mexico.prj")
# Print some properties of the SpatialReference class object.
#
SR = desc.spatialReference
print "Name:            " + SR.name
print "Type:            " + SR.type
print "isHighPrecision: " + str(SR.isHighPrecision)
print "scaleFactor:     " + str(SR.scaleFactor)

It appears that with version 10.3, you should reference the shape file (shp) and not the projection (prj) file for Describe to work properly.

2 Replies
RebeccaStrauch__GISP
MVP Esteemed Contributor

I just test with 10.2.2 and received an error with that too.

Traceback (most recent call last):

  Python Shell, prompt 1, line 7

AttributeError: DescribeData: Method spatialReference does not exist

I suggest going to the

on the help page so they can update the code.

0 Kudos
RandyBurton
MVP Regular Contributor

I did "provide feedback" prior to posting this.  My previous test used 10.2.1.

Thanks.