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– Dowlers2014年08月22日 22:30:49 +00:00Commented Aug 22, 2014 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– PolyGeo ♦2014年08月22日 22:31:50 +00:00Commented Aug 22, 2014 at 22:31
-
@Dowlers yes it's versioned and I can create new data just fine in ArcMap.geogeogeo– geogeogeo2014年08月22日 22:32:09 +00:00Commented Aug 22, 2014 at 22:32
-
@PolyGeo it just sends the same message but in a popup window.geogeogeo– geogeogeo2014年08月22日 22:32:37 +00:00Commented Aug 22, 2014 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– PolyGeo ♦2014年08月22日 22:34:34 +00:00Commented Aug 22, 2014 at 22:34
2 Answers 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– Brad Nesom2014年08月23日 20:40:25 +00:00Commented Aug 23, 2014 at 20:40
-
1
-
@BradNesom yeah, it's still a bit of a pain though. They really have their hands on everything in the database.geogeogeo– geogeogeo2014年08月24日 07:36:42 +00:00Commented Aug 24, 2014 at 7:36
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
Explore related questions
See similar questions with these tags.