I am trying to obtain the spatial reference for lists of feature classes using the following code;
def spatialFileListing(): for root, dirs, files in os.walk(inputLocation): for d in dirs: workspace = os.path.join(root, d) arcpy.env.workspace = workspace fcList = arcpy.ListFeatureClasses() for fc in fcList: fcPath = os.path.join(workspace, fc) desc = arcpy.Describe(fcPath) descSR = desc.SpatialReference.Name print(descSR)
The below error message is returned;
"AttributeError: DescribeData: Method SpatialReference does not exist".
However, when I substitute for a fixed path to a shapefile e.g.:
fcPath = r"C:\Fixed\Path\To\Shapefile\A_Shapefile.shp"
The spatial reference is returned. E.g.:
I'm sure it is something to do with the name / structure of the feature class being returned within the for loop, but don't know how to resolve it.