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)
Solved! Go to Solution.
apparently need to use:
'Shape'
instead of
'Shape@'
when using the non-arcpy.da cursors
😞
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
File "E:\Data\SIMS\PY\test4.py", line 65, in <module>
Your script as shown only goes to line 59.....
see line 49 (i removed some lines that were writing to log files)
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.
apparently need to use:
'Shape'
instead of
'Shape@'
when using the non-arcpy.da cursors
😞
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?
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:
Oh; I see now.... Agreed. 😞