AnsweredAssumed Answered

Python arcpy.da.InsertCursorworkspace: already in transaction mode

Question asked by jsn on Mar 4, 2016
Latest reply on Mar 4, 2016 by Dan_Patterson

Hello everyone,

 

I am exporting code from arcpy.InsertCursor to arcpy.da.InsertCursor and I am getting the following error message:

 

Python Error occurred: workspace already in transaction mode

 

 

In the program I have reading cursor and two insert cursors.

 

curAppend = arcpy.da.InsertCursor(AGREEMENT_I, fieldnamesDelta)
 curUpdate = arcpy.da.InsertCursor(AGREEMENT_U, fieldnamesDelta)


 for  rowToday in curToday:
        agreementID = rowToday[1]
        datetimeVal = rowToday[4]


        if datetimeVal is not None  and agreementID is not None:


            whereClause = '"AGMID" = %s' % (agreementID)


            srcYesterday = arcpy.da.SearchCursor(AGREEMENT, fieldnamesYesterday, whereClause)


            count = 0


            for  rowYesterday in srcYesterday:


                if  rowYesterday[4]  == rowToday[4] :
                    count = count + 1


                    if rowYesterday[5] != rowToday[5] or rowYesterday[6] != rowToday[6] \
                       or rowYesterday[7] != rowToday[7] or rowYesterday[8] != rowToday[8] \
                       or rowYesterday[9] != rowToday[9] or rowYesterday[10] != rowToday[10] \
                       or rowYesterday[11] != rowToday[11] or rowYesterday[12] != rowToday[12] \
                       or rowYesterday[13] != rowToday[13]  or rowYesterday[14] != rowToday[14] :
                            print "Record for Update :", agreementID
                            logging.info('Update ' + whereClause)
                            curUpdate.insertRow(rowToday)


            if count == 0:
                print "Record for Insert :", agreementID
                logging.info('Insert ' + whereClause)
                curAppend.insertRow(rowToday)


.....

Outcomes