<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Help with BUG-000094056 Workaround  in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/help-with-bug-000094056-workaround/m-p/195015#M14962</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #3d3d3d; font-family: arial,helvetica,'helvetica neue',verdana,sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; word-wrap: break-word;"&gt;"arcpy.env.workspace.Database Connections\\TaskmasterServer.sde"&lt;/SPAN&gt; doesn't look like a proper workspace&lt;/P&gt;&lt;P&gt;This would be a better example in the code section&lt;/P&gt;&lt;P&gt;&lt;A href="http://pro.arcgis.com/en/pro-app/arcpy/data-access/editor.htm"&gt;http://pro.arcgis.com/en/pro-app/arcpy/data-access/editor.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Apr 2018 21:59:26 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2018-04-04T21:59:26Z</dc:date>
    <item>
      <title>Help with BUG-000094056 Workaround</title>
      <link>https://community.esri.com/t5/python-questions/help-with-bug-000094056-workaround/m-p/195014#M14961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Except for some of the workaround scripting provided to me by ESRI, this script &lt;STRONG&gt;works great&lt;/STRONG&gt; on my desktop but not on my SQL Server. From talking with ESRI about this,&amp;nbsp; they are reporting that I am hitting a bug (&lt;SPAN style="font-size: 12.0pt;"&gt;BUG-000094056)&lt;/SPAN&gt;.&amp;nbsp; The ESRI quote is as follows:&amp;nbsp;&lt;SPAN style="font-size: 12.0pt;"&gt;The arcpy.da.Editor class does not properly utilize an edit session to edit feature classes participating in a composite relationship class when the 'with' statement is used. As follows is their suggested workaround: (Unfortunately, I cannot get the work around to work:&amp;nbsp;&lt;SPAN&gt;My ERROR: RuntimeError: cannot open workspace)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Explicitly open an edit session and operation:&amp;nbsp;&lt;BR /&gt;# Start an edit session. Must provide the workspace.&amp;nbsp;&lt;BR /&gt; edit = arcpy.da.Editor(arcpy.env.workspace)&amp;nbsp;&lt;BR /&gt;# Start an edit session.&amp;nbsp;&lt;BR /&gt; edit.startEditing(False,False)&amp;nbsp;&lt;BR /&gt;# Start an edit operation.&amp;nbsp;&lt;BR /&gt; edit.startOperation()&amp;nbsp;&lt;BR /&gt;# Edit the data.&amp;nbsp;&lt;BR /&gt; (This would be where your update script would go)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN style="font-size: 12.0pt;"&gt;# Stop the edit operation.&amp;nbsp;&lt;BR /&gt; edit.stopOperation()&amp;nbsp;&lt;BR /&gt;# Stop the edit session and save the changes.&amp;nbsp;&lt;BR /&gt; edit.stopEditing(True)&lt;BR /&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to get the workaround to work?&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thank You, Larry Adgate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;# Start an edit session. Must provide the workspace.&amp;nbsp;&lt;BR /&gt;workspace = "arcpy.env.workspace.Database Connections\\TaskmasterServer.sde"&lt;BR /&gt;edit = arcpy.da.Editor(workspace)&lt;/P&gt;&lt;P&gt;# Start an edit session. &lt;BR /&gt;edit.startEditing(False,False)&lt;/P&gt;&lt;P&gt;# Start an edit operation. &lt;BR /&gt;edit.startOperation()&lt;/P&gt;&lt;P&gt;# above is some of the work around stuff and below is my script.&lt;BR /&gt;newfc = "sde_gsw.GSW_SDE.CCB_Data\\sde_gsw.GSW_SDE.Master_CCB_Points"&lt;BR /&gt;basefc = "sde_gsw.GSW_SDE.CCB_Data\\sde_gsw.GSW_SDE.CCB_ServiceLines"&lt;/P&gt;&lt;P&gt;# empty dictionary&lt;BR /&gt;dict = {}&lt;/P&gt;&lt;P&gt;# read PREM_ID as key and coordinates &lt;BR /&gt;with arcpy.da.SearchCursor(newfc,['PREM_ID','SHAPE@X','SHAPE@Y']) as cur:&lt;BR /&gt; for row in cur:&lt;BR /&gt; dict[row[0]]= {'x':row[1],'y':row[2] }&lt;/P&gt;&lt;P&gt;# update old feature&lt;BR /&gt;with arcpy.da.UpdateCursor(basefc,['PREM_ID','SHAPE@X','SHAPE@Y']) as upCur:&lt;BR /&gt; for row in upCur:&lt;BR /&gt; # if PREM_ID is in dictionary, update x,y else skip update&lt;BR /&gt; if row[0] in dict:&lt;BR /&gt; row[1] = dict[row[0]]['x']&lt;BR /&gt; row[2] = dict[row[0]]['y']&lt;BR /&gt; upCur.updateRow(row)&lt;BR /&gt; print "Updated {}".format(row[0])&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#Below is more workaround stuff&lt;/P&gt;&lt;P&gt;#Stop the edit operation.&amp;nbsp;&lt;BR /&gt;edit.stopOperation()&lt;/P&gt;&lt;P&gt;#Stop the edit session and save the changes. &lt;BR /&gt;edit.stopEditing(True)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2018 21:43:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-bug-000094056-workaround/m-p/195014#M14961</guid>
      <dc:creator>LarryAdgate</dc:creator>
      <dc:date>2018-04-04T21:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: Help with BUG-000094056 Workaround</title>
      <link>https://community.esri.com/t5/python-questions/help-with-bug-000094056-workaround/m-p/195015#M14962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #3d3d3d; font-family: arial,helvetica,'helvetica neue',verdana,sans-serif; font-size: 15px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; word-wrap: break-word;"&gt;"arcpy.env.workspace.Database Connections\\TaskmasterServer.sde"&lt;/SPAN&gt; doesn't look like a proper workspace&lt;/P&gt;&lt;P&gt;This would be a better example in the code section&lt;/P&gt;&lt;P&gt;&lt;A href="http://pro.arcgis.com/en/pro-app/arcpy/data-access/editor.htm"&gt;http://pro.arcgis.com/en/pro-app/arcpy/data-access/editor.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2018 21:59:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/help-with-bug-000094056-workaround/m-p/195015#M14962</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-04-04T21:59:26Z</dc:date>
    </item>
  </channel>
</rss>

