Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import arcpy
- def FindField(fc,myField):
- fieldList = arcpy.ListFields(fc)
- for field in fieldList:
- if str.lower(str(field.name)) == str.lower(myField):
- print " " + fc + " contains fieldname: " + myField
- def FindField2(fc,myField2):
- fieldList = arcpy.ListFields(fc)
- for field in fieldList:
- if str.lower(str(field.name)) == str.lower(myField2):
- print " " + fc + " contains fieldname: " + myField2
- myField = "RuleID"
- myField2 = "Override"
- dir = r'D:Testgdb'
- arcpy.env.workspace = dir
- gdbList = arcpy.ListWorkspaces('*','FileGDB')
- for gdb in gdbList:
- arcpy.env.workspace = gdb
- datasetList = arcpy.ListDatasets('*','Feature')
- fieldList = arcpy.ListFeatureClasses()
- for fc in fieldList:
- print arcpy.env.workspace,fc
- print "Searching root level Featureclasses..."
- print " Searching " + fc
- FindField(fc,myField)
- FindField(fc,myField2)
- for dataset in datasetList:
- arcpy.env.workspace = dataset
- fieldList = arcpy.ListFeatureClasses()
- for fc in fieldList:
- print arcpy.env.workspace,fc
- print " Searching Featureclass... " + fc
- FindField(fc,myField)
- FindField(fc,myField2)
- D:TestgdbRT_FactGeology_Qld_25K.gdb Rio_FactGeology_Qld_L
- Searching root level Featureclasses...
- Searching Rio_FactGeology_Qld_L
- Rio_FactGeology_Qld_L contains fieldname: RuleID
- Rio_FactGeology_Qld_L contains fieldname: Override
- D:TestgdbRT_Roads_Qld_25K.gdb Rio_Roads_Qld_L
- Searching root level Featureclasses...
- Searching Rio_FactGeology_Qld_L
- Rio_Roads_Qld_L contains fieldname: RuleID
- Rio_Roads_Qld_L contains fieldname: Override
- Runtime error
- Traceback (most recent call last):
- File "<string>", line 31, in <module>
- File "<string>", line 6, in FindField
- UnicodeEncodeError: 'ascii' codec can't encode character u'xf3' in position 7: ordinal not in range(128)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement