RuntimeError: cannot open feature class

7496
10
Jump to solution
05-26-2015 01:46 PM
CarloFrate
Occasional Contributor

My script below gets to the first feature class in the list and bails with:

RuntimeError: cannot open 'Roads'

I tested it in a file geodatabase and it worked as intended. Tried next with a connection to an SDE version and it failed.

User connection has full edit privileges to all GDB contents, so it should not be a permissions issue.

Anything additional I must do for an SDE geodatabase? Other thoughts?

    edit.startEditing(True)

    for fc in fclist:
        with arcpy.da.UpdateCursor(fc, ("OBJECTID", "OID@")) as cur:
            for row in cur:
                row[0] = row[1]
                cur.updateRow(row)
                del row
            del cur

    edit.stopEditing(True)

0 Kudos
10 Replies
CarloFrate
Occasional Contributor

Yes, I've tried the edit session using 2-3 different methods, but none so far have worked. And, again, this script as posted worked on the file GDB; only repeating it in SDE is proving difficult.

In this case, the field "OBJECTID" is not the OID. The operation should calculate the field to be the same value as the OID field. Convoluted, I know, but it's a temporary fix to a separate problem.

Thanks!