0

I am trying to use the UpdateCursor function to run through each field in each row and to compile a string which is then added to the AbvField. I'm trying to do this in the python window, rather than as a standalone script.

I get the error: Runtime error : Row: Field updateRow does not exist

I have included all the code except for the subs dict, which is simply a dictionary of species names (keys) and abbreviations (values) with which the script creates the string for the AbvField. Everything works fine except for the updating the field.

TheShapefile="Primary_biodiversity_layer"
AbvField = "Sp1"
Rows=arcpy.UpdateCursor(TheShapefile)
Fields = arcpy.ListFields(TheShapefile)
SpList = []
newDict = {}
for TheRow in Rows: 
 RString = ""
 for TheField in Fields:
 TheFieldName=TheField.name
 TheValue=TheRow.getValue(TheFieldName)
 if TheValue == "":
 pass
 elif TheValue not in subs.keys():
 pass
 else:
 RString += subs[TheValue] + ", "
 if TheValue not in newDict.keys():
 newDict[TheValue] = subs[TheValue]
 else:
 pass
 TheRow.setValue(AbvField, RString)
 TheRow.updateRow(TheRow)
 del TheRow
Vince
20.5k16 gold badges49 silver badges65 bronze badges
asked Mar 3, 2016 at 10:14

1 Answer 1

2

The indentation in your code snippet looks a little astray but I think what is giving you the error you reported is that you have:

TheRow.updateRow(TheRow)

when it should be:

Rows.updateRow(TheRow)
answered Mar 3, 2016 at 10:48
0

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.