I'm trying to search through a directory of shp files for any shp file with a specific field that is empty. Here is my code as of right now.
import arcpy from arcpy import env env.workspace = r'C:\Workspace\Data_State\MS\Administrative_Boundaries\2013_complete' fc = arcpy.ListFeatureClasses('*.shp') fields = "MP_TYPE" for field in fields: #get list of values values = [r for r in arcpy.da.SearchCursor (fc, field) if r != None] #Check if list is empty if not values: print field, "is empty"
I keep getting a runtime error 'in_table' is not a table or a featureclass I've looked at other examples on here and can't get any of them to work.
- the script would cycle through the directory
- print the shp file with the empty attribute value
- then move on because I'm going to have many directories to search through.
Unfortunately, I can't put the shp files into a gdb for this. I'm using 10.3, so if possible I'd like to use arcpy.da.SearchCursor. I just can't seem to get it to work with the shp files.