I work with arcmap 10.3 and python 2.7.8. I have more than 500 shapefiles located in many folders and subFolders. All Sub Folders are located in one large directory. I try with arcpy to detect all shapefiles that have in their attribute table ,in field name "YEUD", the value 20. I search all shape files that begin with letters "mig". Finally i tried to print all the shapefiles that had been found with value 20 in it.
When i run this code i get en error:
import arcpy,os,sys,string,fnmatch
import arcpy.mapping
from arcpy import env
rootPath = r"C:\Project\layers"
pattern = 'mig*.shp'
fields = arcpy.ListFields(rootPath)
for root, dirs, files in os.walk(rootPath):
for filename in fnmatch.filter(files, pattern):
print( os.path.join(root, filename))
for field in fields:
with arcpy.da.SearchCursor(rootPath, field.name) as rows:
for row in rows:
if field.name == 'YEUD':
if row == '20':
print( os.path.join(root, filename))
RuntimeError: ERROR 999999: Error executing function.
>>>
I can't understand why it doesn't work ?