Select to view content in your preferred language

InsertCursor throwing "error return without exception set"

1218
5
10-20-2021 06:09 AM
JD_1609
Emerging Contributor

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().

Tags (2)
0 Kudos
5 Replies
by Anonymous User
Not applicable

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}')

 

0 Kudos
JD_1609
Emerging Contributor

yes, I have it in try/except block and from that is "error return without exception set"... 😕

0 Kudos
by Anonymous User
Not applicable

Paste the full error message/code.

0 Kudos
JD_1609
Emerging Contributor

That's the **bleep**... This - "error return without exception set" - is full message what I get... NOTHING else 😄

0 Kudos
by Anonymous User
Not applicable

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.