2

We are running ArcGIS Desktop 10.1 SP1, and also have ArcFM installed.

I have this simple code:

workspace = "C:\\my.sde"
arcpy.env.workspace = workspace

edit = arcpy.da.Editor(arcpy.env.workspace)
edit.startEditing(False, True)
edit.startOperation()

with arcpy.da.InsertCursor("C:\\my.sde\\dataset\\feature", ("Comments")) as icur:
    try:
        icur.insertRow(["Test comment"])

    except Exception as e:
        print e

edit.stopOperation()
edit.stopEditing(True)

I receive the very specific (/s) error:

SystemError: error return without exception set

I've tried the same code on a different feature class in the same geodatabase and I get:

RuntimeError: Field is not editable.

But I can't think of any reason why it's not editable. I can edit the data in ArcMap just fine. Any idea what could be wrong?

  • Is your dataset registered as versioned? Can you create a new row manually in ArcMap? – Dowlers Aug 22 '14 at 22:30
  • Would you be able to remove your try/except statement to let Python display more of an error message and then post that, please? And something else I often recommend doing is to try substituting your ArcSDE feature class for a file geodatabase feature class to see if this is the Python code rather than ArcSDE. – PolyGeo Aug 22 '14 at 22:31
  • @Dowlers yes it's versioned and I can create new data just fine in ArcMap. – geogeogeo Aug 22 '14 at 22:32
  • @PolyGeo it just sends the same message but in a popup window. – geogeogeo Aug 22 '14 at 22:32
  • Where's the popup window coming from? Try running it from an IDE like IDLE to keep the test as simple as possible. – PolyGeo Aug 22 '14 at 22:34
2

It had to do with ArcFM, which I had a feeling was the problem.

The script needs to checkout a license.

They have a sample script available:

How-To - Work with ArcFM features in Python

Solution

As when working with ArcFM features in VBA, ArcGIS for Desktop, or anywhere else, an ArcFM license is required to edit the features...

  • The reason for this is because of the com objects in the database. I have seen earlier the use of removing the arcfm objects, run the esri script and rebiild the arcfm. It is nice to know they now have script license checkout to enable esri functionality and not have to remove arcfm objects. – Brad Nesom Aug 23 '14 at 20:40
  • 1
    I found the python snippet near the bottom of this page to be helpful to checkout an ArcFM license. – Adam Aug 23 '14 at 23:01
  • @BradNesom yeah, it's still a bit of a pain though. They really have their hands on everything in the database. – geogeogeo Aug 24 '14 at 7:36
0

Field Lengths

Insufficient length in a field can cause this. Especially when using cursors to copy values from one feature class to another, it can be tricky to see what fields may be short in length.

Here is a helpful geonet thread on the issue as well: https://community.esri.com/thread/91717

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.