When updating M-values in a feature class using the data access module, I encounter the error below when I run the following code on a selected segment in ArcMap using a Python Add-In call to a Python tool. However, the M-values still update. I am wondering if this is a bug. I also tried this using "SHAPE@JSON" and got the same error, but the M-values still updated. Anybody else have this issue, or have some insight on why this error is being thrown?
I am doing this inside an ArcMap edit session (ESRI Editor). After I run the da.updateCursor, I do some other non 'da' updates, so the commits get pushed through SDE to the underlying SQLServer database. I am on 10.2.1
import json, math lin_ref = {'MILEPOST_FR': 1, 'MILEPOST_TO': 10} with arcpy.da.UpdateCursor(segmentfc,["SHAPE@"]) as cursor: for row in cursor: json_obj = json.loads(row[0].JSON) mp_to = len(json_obj['paths'][0]) - 1 fulldist = row[0].getLength('PLANAR', 'FEET') conversionfactor = (math.fabs(lin_ref['MILEPOST_TO'] - lin_ref['MILEPOST_FR']) / fulldist) for i,v in enumerate(json_obj['paths'][0]): if i == 0: json_obj['paths'][0][2] = float(lin_ref['MILEPOST_FR']) else: # distance in map units between last vertex and current vertex x1vert = json_obj['paths'][0][0] - json_obj['paths'][0][i-1][0] y1vert = json_obj['paths'][0][1] - json_obj['paths'][0][i-1][1] vertdist = math.sqrt(x1vert**2 + y1vert**2) vert_lrdist = vertdist * conversionfactor json_obj['paths'][0][2] = json_obj['paths'][0][i-1][2] + float(vert_lrdist) for feature in json_obj['paths']: pline = arcpy.Polyline(arcpy.Array( [arcpy.Point(X=coords[0], Y=coords[1], M=coords[2]) for coords in feature]), row[0].spatialReference, False, True) row[0] = pline cursor.updateRow(row) Traceback (most recent call last): File "<string>", line 1896, in execute SystemError: error return without exception set
The line where the error occurs is
cursor.updateRow(row)
Did you ever solve your problem? I'm having a similar issue.
Scott and Ed: This issue will be resolved in the next release of ArcGIS.
What was the next release of ArcGIS and would this be patched in 10.2.1?
Old thread...but
I believe 10.4.0 was released after Sept 2015, so maybe, per Shaun "This issue will be resolved in the next release of ArcGIS."
10.4.1 was rumored to be released in June, before the UC....but I typically take that as a target date and don't hold them to it.
Yes, the issue was resolved in 10.4.0. It isn't identified as a candidate for service packs, so won't make it into 10.2.1. That said, there is a workaround -- write to a FGDB data source instead of a Shapefile.