RuntimeError : cannot open workspace

386
0
05-02-2023 09:26 AM
Labels (2)
minhomo28
New Contributor III

Hi, 

I am getting error " Cannot Open Workspace " with arcpy.da.Editor(arcpy.env.workspace). I am working on a versioned data. 

Anyone can help me on this? 

Here is a code I am stuck on. 

# Append point feature to corresponding feature class
with arcpy.da.SearchCursor(output_txt, ["Layer", "X", "Y"], where_clause="Layer = 'Water Hydrant'") as cursor:
    for layer, x, y in cursor:
        #Set Workspace
        arcpy.env.workspace = os.path.join ("J:\OMSTEST.sde", "OMSTest.DBO.Water", "OMSTest.DBO.WATER_HYDRANTS")
 
        # Create point geometry object
        point = arcpy.Point()
        point.X = x
        point.Y = y
        point_geometry = arcpy.PointGeometry(point, spatial_reference)
        # Start edit session for target feature class
        edit = arcpy.da.Editor(arcpy.env.workspace)
        edit.startEditing(False, True)
        edit.startOperation()
 
Thanks
0 Kudos
0 Replies