I am trying to iterate through all my shapefiles to check if they have a coordinate system assigned or not.
The script works fine and iterates through most of my .shp files, however some files seem to have some issues due to unknown reasons and stop the iteration process. The core part of my script, where the error is located is the following:
import arcpy from arcpy import env import os folder = 'C:\\myfolder' arcpy.env.workspace = folder fcs = arcpy.ListFeatureClasses() for shp in fcs: print '\t', shp dsc = arcpy.Describe(shp) print(arcpy.Exists(shp)) if dsc.spatialReference is None: print('shape not readable: ' + folder) else: sr = dsc.spatialReference
I was able to deal with some problems using the
if dsc.spatialReference is None: exception.
Currently I am getting the following error which is was not able to find a solution for. I do not necessarily need to resolve that error. I just want to skip that shapefile and continue with my script.
Runtime error Traceback (most recent call last): File "", line 18, in AttributeError: DescribeData: Method spatialReference does not exist