Hello, I am a python novice and am having some trouble with what I assume is an easy fix. I have a feature class that I added a new field to (Geology_Class). I want to update the new field with the items from my dictionary. The keys in the dictionary are PTYPE and I want the new field to contain the values. I created a search cursor so that it would loop through the existing PTYPE field (there are about 60) in my feature class. I then added the update cursor so that it would search the PTYPE and add it to the new Geology_Class field. When I run the script I get an error "Traceback (most recent call last): "File "C:\Users\Users\Desktop\GeoDis.py", line 42, in <module> row[2] = dictionary(row[1]) TypeError: 'dict' object is not callable." Upon reading other forums is looks like I am trying to call a function when in reality it's not? Or maybe use the .updateRow?I know there are other methods in doing something so simple but using python was requested. Any help you can offer is greatly appreciated. Thank you.Using ArcGIS 10.0 # Import arcpy module
import arcpy
from arcpy import env
arcpy.env.overwriteOutput = True
dictionary = {'C':'INSERT1','Ca':'Coarse-Competent','D':'INSERT2' ,'E':'Fine-Competent','Ec':'Coarse-Competent','E-Ep':'INSERT3',
'Ep':'Coarse-Competent','gb':'Crystalline','gr':'INSERT4','grCz':'INSERT5','grCz?':'INSERT6','gr-m':'Crystalline','grMz':'Crystalline', 'grMz?':'Crystalline',
'grpC':'INSERT7','grpC?':'INSERT8', 'grPz':'INSERT9','J':'INSERT10','J?':'INSERT11','K':'Fine-Competent','K?':'Fine-Competent','KJf':'INSERT12',
'KJfm':'INSERT13','KJfs':'INSERT14','Kl':'INSERT15','Kl?':'INSERT16','Ku':'Coarse-Weak','Ku-Ep':'INSERT17',
'ls':'INSERT18','M':'Coarse-Competent','M?':'Coarse_Competent','m':'Fine-Competent','M+KJfs':'INSERT19','Mc':'Coarse-Competent',
'Mexico':'Mexico','mv':'Fine-Competent'}
Input_Geology_Feature_Class = arcpy.GetParameterAsText(0)
attributes = arcpy.SearchCursor(Input_Geology_Feature_Class,"","","PTYPE","")
arcpy.AddMessage("Adding Geology Class Field...")
arcpy.AddField_management(Input_Geology_Feature_Class, "Geology_Class","TEXT")
arcpy.AddMessage("Populating Geology Class Field, Please Wait...")
geology = arcpy.da.UpdateCursor(Input_Geology_Feature_Class,["PTYPE","Geology_Class"])
for row in geology:
row[2] = dictionary(row[1])
geology.updateRow(row)
del row, geology