I'm trying to delete a few rows in the output table that is created using the Compare Table tool (anything that has an ObjectID < 0). My script was working fine (i.e. it produced the table compare output), until I inserted this Update Cursor code. It's throwing me a RuntimeError: create cursor has failed error. I tested a Search cursor in its place, and that worked fine. I'm thinking there may be a lock of some sort on the data since it was just created, but I'm not sure how to clear that lock. Any ideas?
arcpy.TableCompare_management(orig_queryTable, arcgisTable_cleaned, "UNIQUE_ID", "ATTRIBUTES_ONLY", "IGNORE_SUBTYPES", "", "", "CONTINUE_COMPARE", out_compare_file=compareTxtFile) sqlExp = """ "ObjectID" < 0 """ with arcpy.da.UpdateCursor(compareTxtFile, "ObjectID", sqlExp) as deleteCursor: for row in deleteCursor: deleteCursor.deleteRow(row)
أكثر...
arcpy.TableCompare_management(orig_queryTable, arcgisTable_cleaned, "UNIQUE_ID", "ATTRIBUTES_ONLY", "IGNORE_SUBTYPES", "", "", "CONTINUE_COMPARE", out_compare_file=compareTxtFile) sqlExp = """ "ObjectID" < 0 """ with arcpy.da.UpdateCursor(compareTxtFile, "ObjectID", sqlExp) as deleteCursor: for row in deleteCursor: deleteCursor.deleteRow(row)
أكثر...