AnsweredAssumed Answered

Trouble using arcpy.da.insertCursor() on a registered version. Does anyone have any insight or work arounds?

Question asked by miguel.torres on Apr 3, 2018
Latest reply on Apr 3, 2018 by blake.terhune

I have been plugging along quite deligently on a GUI tool that I have posted on here before. This time i am asking about an error I get that seems to occur when i try to use insertRow() along with a registeredVersion of a featureclass.

The script works perfectly fine when it is not operating on a versioned data set, and so I am a little confused about how to proceed.

Error when edit.startEditing(True, False)

workspace already in transaction mode

Error when edit.startEditing(True)

error return without exception set

Here is some code I am using, the input is just a .csv of y,x coordinates.

import arcpy, os f = open(".../swPointTest.txt") lstNodes = f.readlines() try:     edit = arcpy.da.Editor(r"Database Connections\PW_Tax_sql_PW.sde")     edit.startEditing(True, False)     cntr = 0     with arcpy.da.InsertCursor(r"Database Connections\PW_Tax_sql_PW.sde\PW.PW.swNodes",("SHAPE@XY", "ASBUILTID","PROJECTID")) as cur:         for node in lstNodes:             cntr += 1             vals = node.split(",")             latitude = float(vals[0])             longitude = float(vals[1])             ABID = "FTR-" + str(cntr)             PID = float(1354.07)             print("Latitude: " + str(latitude) + " x Longitude: " + str(longitude))             rowValue = [(latitude,longitude),ABID,PID]             print(rowValue)             cur.insertRow(rowValue)             print("Inserted Node")     edit.stopEditing(True) except Exception as e:     print(e.message) finally:     f.close()

Thank you for any insight you may be able to provide.

Just to add, after a little bit of digging i managed to find a thread here about a similar issue has persisted since 10.0. It seems like my issue is related to this one.

Outcomes