I'm getting the following error "Type Error: 'dict' object is not callable"
, with the code below:
import arcpy
def printDict(dictionary, printCount=False):
for key in dictionary:
arcpy.AddMessage(key + ": " + dictionary[key])
if printCount is True:
arcpy.AddMessage(str(len(dictionary)))
pld3GDB = 'C:\\Users\\bro81520\\Documents\\ArcGIS\\PLDV3_SPC_ODN_315_25Sep\\PLDV3_SPC_ODN_315_25Sep.gdb\\WO_HIERARCHY'
fdaAREA = 'C:\\Users\\bro81520\\Documents\\ArcGIS\\Default.gdb\\FDA_AREA'
d = dict() # VENDOR_WO_ID : NFID
fields1 = ['VENDOR_WO_ID', 'NFID', 'ISFDA']
with arcpy.da.SearchCursor(pld3GDB, fields1) as cursor:
for row in cursor:
if row[2] == "Y":
d[row[0]] = row[1]
# print dictionary
printDict(d, printCount=True)
fields2 = ['bv_workorderid', 'bv_nfid']
with arcpy.da.UpdateCursor(fdaAREA, fields2) as cursor:
for row in cursor:
if row[0] in d:
row[1] = d[row[0]]
cursor.updateRow(row)
I've looked at the following resources, but haven't deciphered exactly what is wrong:
https://stackoverflow.com/questions/41605525/typeerror-dict-object-is-not-callable-while-using-dict
https://gis.stackexchange.com/questions/198770/creating-a-dict-with-search-cursor
dict
anywhere else in your code?d = {}
?"Parsing error SyntaxError: invalid syntax (line 12)"
d = {}
should be valid syntax