1

I'm using a dictionary created by a search cursor from one feature class to update another feature class with an update cursor. I'm getting an invalid syntax error for the cursor.updateRow(row) and..have no idea why.

There must be something blatant I'm missing, yet I am simply not seeing it. Can someone point out why this code snippet would be providing an invalid syntax error for cursor.updateRow(row)? The format, from what I see, matches all the examples I've found.

 with arcpy.da.UpdateCursor(testingSHP, ['SERVICEMXL','STREETADDR']) as cursor:
 for row in cursor:
 mxLoc = row[0]
 oldAddr = row[1]
 if mxLoc in svcDict:
 print("Looking at row {0} with an address of {1}.".format(mxLoc, row[1]))
 row[1] = svcDict(mxLoc)
 print("Address is now {0}.".format(row[1])
 cursor.updateRow(row)
 del cursor
asked May 22, 2020 at 13:14
1
  • You're missing a closing parenthesis - change print("Address is now {0}.".format(row[1]) to print("Address is now {0}.".format(row[1])) Commented May 23, 2020 at 3:17

1 Answer 1

2

I think you need to change: row[1] = scvDict(mxLoc) to row[1] = scvDict[mxLoc]

Also, oldAddr is currently unused, which is fine, but you could change this line to use it. print("Looking at row {0} with an address of {1}.".format(mxLoc, oldAddr))

answered May 22, 2020 at 13:40

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.