Hi,
I'm trying write data to an Enterprise geodatabase but it still throws error return without exception set (for clarification - error throws row cursor.insertRow(data).
I have method:
def __insertDataInternal(self, table, cols, data): with arcpy.da.InsertCursor(table, cols) as cursor: cursor.insertRow(data)
which I'm using for write to local gdb and remote (sde). For local gdb is everything alright and data are inserted. But when I use this method for write to Oracle it throws error.
Code for calling to write to EGDB looks this:
db = r"C:\Temp\file.sde"
edit = arcpy.da.Editor(db) edit.startEditing(False, True) edit.startOperation() self.__insertDataInternal(table_path, cols, data) edit.stopOperation() edit.stopEditing(True)
I'm using versioned DB (Oracle) and the connection is set looking to version I need. All input data and cols are correct.
When I was googling so I found only solutions with errors from startOperation() or startEditing() but nowhere is error straight from insertRow().
It's saying there is an unhandled error occurring. Wrap the process in a try/ except block to capture it and see what it is.
try:
edit = arcpy.da.Editor(db)
edit.startEditing(False, True)
edit.startOperation()
self.__insertDataInternal(table_path, cols, data)
edit.stopOperation()
edit.stopEditing(True)
except Exception as ex:
print(f'Failed: {ex}')
yes, I have it in try/except block and from that is "error return without exception set"... 😕
Paste the full error message/code.
That's the **bleep**... This - "error return without exception set" - is full message what I get... NOTHING else 😄
Is the length of your fields in your 'data' longer than the length allowed in any of the fields?
add a print statement to your insert cursor and watch what values are being inserted and if it fails on one.