Select to view content in your preferred language

python Error 999999 in duplicate append script.

1138
12
Jump to solution
06-27-2023 10:15 AM
Laura_m_Conner
New Contributor III

All,
Recently we have finished innovatory of curbed streets. The curbed streets were appended into a new feature class in batches as an area was finished. Now I am checking to make sure no street segment got appended twice. I have written/modified it the script from Delete the older records of duplicate features after using the Append tool in ArcGIS Pro, for our data.

I am encountering Error 999999. None of the advice from 999999: Something unexpected caused the tool to fail seems applicable. There is no output file, only the original input file is being modified. There is no geometry network. The used fields do not have any null values. Given where it fails in the script, size should not be an issue. Also, there are only about 9,600 records in the table currently. For testing the script, I am running this on a copy of the data set exported from the enterprise geodatabase to the project database. once the script works, it will be run on the enterprise geodatabase copy. I am unable to test it in administrator mode, but I don't see a reason why this should be an issue.

How do I get the script working, or at least get past this error? Any insight is appreciated.
Script:

 

import arcpy

fc = "StormCurbedStr_ExportFeature"
feilds = ["FULLNAME","curb","Shape"]

cursor = arcpy.UpdateCursor(fc, feilds)

keepList = list()
for row in cursor:
    row_val_0 = row.getValue(feilds[0])
    row_val_1 = row.getValue(feilds[1])
    row_val_2 = row.getValue(feilds[2])
    row_val = row_val_0 + row_val_1 + str(row_val_2)
    
    if row_val not in keepList:
        keepList.append(row_val)

    elif row_val in keepList:
        cursor.deleteRow(row)
    
    else:
        pass
print("done")

 

 

error:

 

RuntimeError                              Traceback (most recent call last)
In  [5]:
Line 7:     cursor = arcpy.UpdateCursor(fc, feilds)

File C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py, in UpdateCursor:
Line 1234:  return gp.updateCursor(dataset, where_clause, spatial_reference, fields, sort_fields)

File C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py, in updateCursor:
Line 374:   self._gp.UpdateCursor(*gp_fixargs(args, True)))

RuntimeError: ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds

 

 

notes:

Arcpro 3.1.0

OS: Mircrosoft windows 10 pro for workstations

 

Thank You.

Laura

 

 

 

 

  

Tags (2)
0 Kudos
12 Replies
RhettZufelt
MVP Notable Contributor

@AlfredBaldenweck this looks like in your first example above you meant to change to da.UpdateCursor since you are using the row[i] method instead of the getValue.

@Laura_m_Conner , this would be a good time to use the arcpy.da.UpdateCursor as it is has more power, much, much faster, and, at least for me, is easier to keep straight which field values are what.

Also, I don't see anywhere in the old arcpy.UpdateCursor documentation about how to grab the ("Shape" field).

With the arcpy.da.UpdateCursor, the field would be "SHAPE@" to grab the geometry object.  Suspect this might be part of the issue.

R_

0 Kudos
Laura_m_Conner
New Contributor III

thank you. the script works and dose the job i need it to...for some reason it not checking all the duplicates. there is a handful left. now i need to work on  figuring that out.  

do you know of any good resources I can use in the future?

0 Kudos
RhettZufelt
MVP Notable Contributor

I would start with the Find Identical GP tool and/or the Delete Identical GP tool.

R_