ValueError: Row: Invalid Input Type For Set Value

598
8
Jump to solution
11-29-2018 11:47 AM
deleted-user-7XK9IcRUo5op
New Contributor II

Hi

I'm attempting to roll through a bunch of edits per user input on a point feature. Unfortunately, i get this script to work on non-geometric network features with the arcpy.da editing functions. I'm attempting to use the arcpy.insertCursor here because of that geometric network participation on this point feature. I keep getting this error:

On Line 65 - ValueError: Row: Invalid input value for SetValue

Code is as follows:

import arcpy, time, datetime, os

#Set variables

FilePath = "E:\\Program Files\\Consumers Energy\\SIMS\\MassEdit\\"
SDEUser = (FilePath + "Dev_GasDist_PrimeSDE.sde")                                                                 #SDE connection
VsdeFolder = (FilePath + "SDExnnections")
VersionList = []                                                                                                         #mutable list
VersionCount = 0                                                                                                         #var for amount of versions on mappingdefault
MX = 5000                                                                                                                   #maximum allowed edits
UserInput = int(input('Edits Needed (Divided per versions in mapping default): '))                         #total edits input by user
TotalEdits = UserInput if UserInput < 5000 else MX                                                                  #var for edits
fieldsPoly = ('Shape@')                                                                                                         #fields to fill in for edits
fieldsPoint = ('SHAPE@X','SHAPE@Y')
counterV = 0                                                                                                              #version counter
counterR = 0          

def makeCurbValve(MoveBy2):
     pCurbValve = arcpy.Point(3289001.0213 + MoveBy2,4376077.827 + MoveBy2)
     return arcpy.PointGeometry(pCurbValve)

For ChildVersionName in VersionList:
     counterV = int(counterV + (int(VersionCount) + 8500))
     EditVersion = arcpy.CreateDatabaseConnection_management('''''''')
     T_SDEConnection = (str(EditVersion))
     fc = (T_SDEConnection + "\\GASDIST.P_CurbValve")
     workspace = os.path.dirname(fc)
     Edit = arcpy.da.Editor(workspace)
     Edit.startEditing(False, True)
     Edit.startOperation()
     cursorInsert = arcpy.InsertCursor(T_SDEConnection + "\\GASDIST.P_CurbValve")
     for ChildVersionCount in range(0, int((TotalEdits)/VersionCount)):
          counterR = int(counterR + 5)
          start = time.time()
          CoordXY = makeCurbValve(counterR + counterV)
          InsertNewRow = cursorInsert.newRow()
          InsertNewRow.setValue(fieldPoint,CoordXY)
          cursorInsert.insertRow(InsertNewRow)
          end = time.time()
     Edit.stopOperation()
     Edit.stopEditing(True)
0 Kudos
1 Solution

Accepted Solutions
deleted-user-7XK9IcRUo5op
New Contributor II

apparently need to use:

'Shape'

instead of 

'Shape@'

when using the non-arcpy.da cursors 

:(

View solution in original post

0 Kudos
8 Replies
deleted-user-7XK9IcRUo5op
New Contributor II

This is the entire error message (error is actually on line 49 in the above code):

E:\>E:\Apps\Python27\ArcGIS10.2\python.exe "E:\Data\SIMS\PY\test4.py"
Edits Needed (Divided per versions in mapping default): 10
Traceback (most recent call last):
File "E:\Data\SIMS\PY\test4.py", line 65, in <module>
InsertNewRow.setValue(fieldsPoint,makeCurbValve(counterR + counterV))
File "E:\Apps\ArcGIS\Desktop10.2\arcpy\arcpy\arcobjects\arcobjects.py", line 1
060, in setValue
return convertArcObjectToPythonObject(self._arc_object.SetValue(*gp_fixargs(
args)))
ValueError: Row: Invalid input value for SetValue

0 Kudos
JoeBorgione
MVP Esteemed Contributor

File "E:\Data\SIMS\PY\test4.py", line 65, in <module>

Your script as shown only goes to line 59.....

That should just about do it....
0 Kudos
deleted-user-7XK9IcRUo5op
New Contributor II

see line 49 (i removed some lines that were writing to log files)

0 Kudos
deleted-user-7XK9IcRUo5op
New Contributor II

I've also tried to run the function as:

def makeCurbValve(MoveBy2):
     pCurbValve = arcpy.Point(3289001.0213 + MoveBy2,4376077.827 + MoveBy2)
     return arcpy.PointGeometry(pCurbValve)

 But get:

Runtime 999999 error: unable to execute function

on that same line that is trying to execute the .setValue built in function. I'm beginning to think that there is no way to edit feature classes that belong to a geometric network in ArcPY, which to me is a MAJOR bug.

0 Kudos
deleted-user-7XK9IcRUo5op
New Contributor II

apparently need to use:

'Shape'

instead of 

'Shape@'

when using the non-arcpy.da cursors 

:(

0 Kudos
JoeBorgione
MVP Esteemed Contributor

Interesting.  Your comment on non-da cursors must refer to line 44, where you establish an arcpy.InsertCursor.  I'm curious as to why you are not using an arcpy.da.InsertCursor?

That should just about do it....
deleted-user-7XK9IcRUo5op
New Contributor II

As I mentioned in the original post, it is related to it belonging to a geometric network. There is an ESRI bug related to editing/creating features that belong to geometric networks within the arcpy.da function set:

https://support.esri.com/en/bugs/nimbus/TklNMTAyNzc4

0 Kudos
JoeBorgione
MVP Esteemed Contributor

Oh; I see now....  Agreed.  :(

That should just about do it....
0 Kudos