I am migrating a script tool to client's machine. It was working in my local environment (Pro 3.5.2 against fgdb), but is now failing in the destination environment (Pro 3.3.1, Traditionally versioned SDE 11.2). The tool reverses a singlepart line using `arcpy.edit.flipline()`, before applying other attribute edits to adjacent features. This worked well in a file geodatabase but is now silently failing to flip the line in the destination environment (the whole script executes without errors but fails to flip the line).
I have tried manually running the Flip Line geoprocessing tool in the destination environment and that worked. I have also tried the following changes to the script without success in the destination environment:
- toggling multiuser mode boolean when initializing the edit session
- recreating the flipline function from scratch
Here's 2 versions of the line reversal logic (both of which fail silently in the destination env):
def reverse_pipe_direction(SewerLine):
pipe_count = int(arcpy.management.GetCount(SewerLine)[0])
if pipe_count != 1:
arcpy.AddError(f"Error: This tool can only run on a single pipe at a time. {pipe_count} features were selected.")
raise Exception("Multiple or zero features selected.")
assetID = ''
with arcpy.da.SearchCursor(SewerLine, "assetid") as cursor:
for row in cursor:
assetID = row[0]
arcpy.AddMessage("Reversing Pipe ID: " + assetID)
# Process: Flip Line (edit)
arcpy.edit.FlipLine(in_features=SewerLine)[0]
return SewerLine
def reverse_pipe_direction(SewerLine):
"""Reverses the direction of each single-part polyline in the input feature class"""
pipe_count = int(arcpy.management.GetCount(SewerLine)[0])
if pipe_count != 1:
arcpy.AddError(f"Error: This tool can only run on a single pipe at a time. {pipe_count} features were selected.")
raise Exception("Multiple or zero features selected.")
edit = arcpy.da.Editor(arcpy.env.workspace, multiuser_mode=True)
edit.startEditing()
edit.startOperation()
with arcpy.da.UpdateCursor(SewerLine, ["SHAPE@", "assetid"]) as cursor:
for row in cursor:
arcpy.AddMessage(f"Reversing pipe with AssetID {row[1]}")
points = [pt for pt in row[0].getPart()]
flipped_points = arcpy.Array(reversed(points))
flipped_line = arcpy.Polyline(flipped_points, row[0].spatialReference)
cursor.updateRow((flipped_line, row[1]))
edit.stopOperation()
edit.stopEditing(True)
return SewerLine
Thanks in advance for any pointers!
Source System info:
- ArcGIS Pro 3.5.2 against local File GDB
Destination System Info:
- ArcGIS Pro 3.3.1 against Enterprise DB
- SDE Version 11.2.0 (described as an ArcGIS Pro 3.2.0 - 11.2.0.49743 geodatabase in the Database Properties)
- DB uses Traditional Versioning