AnsweredAssumed Answered

SystemError: error return without exception set

Question asked by jborgion Champion on May 28, 2019
Latest reply on May 29, 2019 by bixb0012

ArcGIS 10.6.1 Windows 10 64 bit.

 

I have a script tool that runs great until I process a certain table in a fgdb.  On two tables it works just fine, and does what I want it to, but when I get to the third table it tosses this error in the script tool window:

 

Traceback (most recent call last):
File "W:\GIS\DataCleanUp.py", line 134, in <module>
main()
File "W:\GIS\DataCleanUp.py", line 131, in main
cleanUp()
File "W:\GIS\DataCleanUp.py", line 105, in cleanUp
edit.stopOperation()
SystemError: error return without exception set

 

The script is set up in different def's() ; my cleanUp() def is what fails:

 

def cleanUp():

    edit = arcpy.da.Editor(ws)
    edit.startEditing(False,False) #use False False: with undo,(False) multiuser mode(False)
    edit.startOperation()
   

   
    tableFields = arcpy.ListFields(tableName,'','String')
    try:
        for f in tableFields:
            fieldNames = []
            fieldNames.append('{}'.format(f.name))
            for fieldName in fieldNames:
                field = [fieldName]
                field.insert(0,'OBJECTID')
                with arcpy.da.UpdateCursor(tableName,field) as updateRows:
                    for updateRow in updateRows:
                        if updateRow[1]== None:
                                pass
                        elif "\n" in updateRow[1]:
                                updateRow[1] = updateRow[1].replace("\n"," ==> ")
                                updateRows.updateRow(updateRow)
                                print('Success: Updated OID:{} in table:{}  field:{}'.format(updateRow[0],tableName,field[1]))

               
    except Exception as err:
        print(err)
        print('{}  {}'.format(updateRow[0],updateRow[1]))
        print('Error: Unable to process {} {}'.format(updateRow[0],field[1]))
       
# =============================================================================
    edit.stopOperation()
    edit.stopEditing(True)
    print('Closed edit session')

It's called from main() and is the last in series of defs.

 

I write to a log file, but the errors I capture there are meaningless at best:

 

(1)The row contains a bad value. [SITENOTES]
(2)99 Safe for 1 sampler. Lots of human/dog activity. Easy to navigate
(3)Error: Unable to process 99 SITEVERIFY

 

(1) is the actual error from ArcGIS although I have no idea what record it fails on or why the [SITENOTES] field is noted

(2) is my error where I capture the the OID, and the contents of the field:  so for whatever reason it's telling me that OID 99 has a [SITENOTES] field value of: Safe for 1 sampler. Lots of human/dog activity. Easy to navigate

(3) is one of my error captures, and is baffling as well, since the SITEVERIFY field isn't even considered for OID 99 or any other.

 

Looking at the error that appears in script tool window, it complains about line 105 which is shown as line 33 in the cleanUp() def shown above.  My logic is to open the edit session, run the update cursor, and then close the edit session.  However, notice line 35 above:  it never does close the edit session.

 

After searching on SystemError: error return without exception set I don't quite understand what it means and/or how to mitigate for it.  Again, the weird thing about this mess is the script tool runs just fine on two other tables. It finds the newline character '\n' and replaces it with '==>' without a problem. This table though has been a problem child from the get go....

Outcomes