Yes it is a geodatabase feature class with attachments enabled. Basically I have a test script which cursors over the features in the feature class and then for each feature cursors over the related attachment records. Pretty standard stuff. It always crashes after 3-4 records. It is important to note that it only crashes when the feature class is registered as versioned and the images in the attachment table are large. I have also had a colleague of mine replicate the issue in a completely separate environment.
We are using desktop 10.4.1 and ArcGIS for Server 10.3.1
Test Script:
# Script to hightlioght insertCursor Issue on attachment table that is versioned in sde
#
# Callum Smith
# 30/6/2016
import arcpy
import os
# Change dataPath to the location of the data
##dataPath = r'D:\CBS\cursorIssue\geodatabase.gdb'
dataPath = r'D:\CBS\cursorIssue\DOWNERGIS@Dev@GISADMIN.sde'
# Run for either Large Images or SmallImages
fcName = 'FC_LargeImages'
#fcName = 'FC_SmallImages'
fc = os.path.join(dataPath, fcName)
attachTable = os.path.join(dataPath, fcName + '__ATTACH')
try:
# Insert Cursor
print 'Running the Cursor on the Featurclass...'
fields = ['GLOBALID']
with arcpy.da.SearchCursor(fc, fields) as searchCursor:
for row in searchCursor:
globalID = row[fields.index('GLOBALID')]
print 'Processing Feature: ' + str(globalID)
edit = arcpy.da.Editor(dataPath)
edit.startEditing(False, True)
edit.startOperation()
# Insert Cursor on attach Table.
count = 1
whereClause = '"REL_GLOBALID" = ' + "'" + str(globalID) + "'"
attachCusorFields = ['CONTENT_TYPE', 'DATA_SIZE', 'DATA', 'ATT_NAME']
with arcpy.da.UpdateCursor(attachTable, attachCusorFields, whereClause) as attachCursor:
for attachRow in attachCursor:
attName = attachRow[attachCusorFields.index('ATT_NAME')]
print ' Attachment: {0} ---> {1}'.format(count, attName)
attachCursor.updateRow(attachRow)
count += 1
# Stop Editing.
edit.stopOperation()
edit.stopEditing(True)
print 'Process Complete.'
except Exception, err:
print err
This is the error I get.
cheers
Callum