SetValue error

276
4
Jump to solution
10-14-2019 04:58 PM
ArianneFord
New Contributor III

Hi all

Having some issues trying to debug someone else's code in Desktop 10.3, and we've traced the issue back to a SetValue call in the script. Adding in our own messages at various points, it seems to make the new row without any issues, but has a problem with SetValue. Outputting the values of fldID and ID to the screen shows that those values are correct at the time of the function call, but using SetValue fails. 

Any ideas? Appreciate any help!

try:
   VTabNNC = arcpy.InsertCursor(vTabNNPath)

except:
   raise arcpy.ExecuteError("InsertCursor error")

while fRBNDX:
   #gp.AddMessage(vTabNNPath)
   if len(strLn01) != 0:
      if len(strLn01.split(",")) < 3:
         strLn01 = ""
      try:
         #gp.AddMessage(vTabNNPath)
         #gp.AddMessage("Creating new row...")
         r = VTabNNC.newRow()  #THIS WORKS
         #gp.AddMessage(ID)
         r.SetValue(fldID,ID) #THIS FAILS 
         #gp.AddMessage(ID)
         VTabNNC.insertRow(r)
      except:
         raise arcpy.ExecuteError("Error creating new row")

0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Esteemed Contributor

in new arcpy for pro it is row.setValue in lower case 's'

View solution in original post

4 Replies
DanPatterson_Retired
MVP Esteemed Contributor

in new arcpy for pro it is row.setValue in lower case 's'

View solution in original post

ArianneFord
New Contributor III

I am still on Desktop 10.3 though...

Anyway, it fixed it! Many thanks

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

not a lot would change along those lines... and make sure you are using the data access cursors to carry you forward when you move to Pro

InsertCursor—Data Access module | ArcGIS Desktop 

ArianneFord
New Contributor III

Yes, noticed that when I was searching the community for an answer. Once we've got it working in 10.3, next step is to migrate it to Pro.

0 Kudos