<?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 Proper arcpy.da.Editor use in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/proper-arcpy-da-editor-use/m-p/391437#M30936</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm on ArcGIS 10.2.2 and trying to use &lt;A href="http://resources.arcgis.com/en/help/main/10.2/018w/018w00000005000000.htm"&gt;arcpy.da.Editor&lt;/A&gt; and an InserCursor on a versioned feature class. The feature class was registered without the option to move edits to base and resides in a 10.0 SDE on Oracle 11g (will be 10.2.2 SDE soon).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found &lt;A href="https://gisnuts.com/terra/blog/2014/05/09/arcpydaeditor-trialsandtribulations"&gt;this helpful post by Leslie Morgan&lt;/A&gt; that really details my same situation, but there are no code samples. I would like to know if any of you have used the Python Editor in a similar setup and what your code looks like. More specifically, can the Editor class be used in a &lt;SPAN style="font-family: 'courier new', courier;"&gt;with&lt;/SPAN&gt; statement like the Esri help article says or do I still have to start and stop the operation and edit session like users say?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Feb 2015 00:32:35 GMT</pubDate>
    <dc:creator>BlakeTerhune</dc:creator>
    <dc:date>2015-02-18T00:32:35Z</dc:date>
    <item>
      <title>Proper arcpy.da.Editor use</title>
      <link>https://community.esri.com/t5/python-questions/proper-arcpy-da-editor-use/m-p/391437#M30936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm on ArcGIS 10.2.2 and trying to use &lt;A href="http://resources.arcgis.com/en/help/main/10.2/018w/018w00000005000000.htm"&gt;arcpy.da.Editor&lt;/A&gt; and an InserCursor on a versioned feature class. The feature class was registered without the option to move edits to base and resides in a 10.0 SDE on Oracle 11g (will be 10.2.2 SDE soon).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found &lt;A href="https://gisnuts.com/terra/blog/2014/05/09/arcpydaeditor-trialsandtribulations"&gt;this helpful post by Leslie Morgan&lt;/A&gt; that really details my same situation, but there are no code samples. I would like to know if any of you have used the Python Editor in a similar setup and what your code looks like. More specifically, can the Editor class be used in a &lt;SPAN style="font-family: 'courier new', courier;"&gt;with&lt;/SPAN&gt; statement like the Esri help article says or do I still have to start and stop the operation and edit session like users say?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Feb 2015 00:32:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/proper-arcpy-da-editor-use/m-p/391437#M30936</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2015-02-18T00:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Proper arcpy.da.Editor use</title>
      <link>https://community.esri.com/t5/python-questions/proper-arcpy-da-editor-use/m-p/391438#M30937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is the basic way I'm using the Editor for now until I find a better way.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;try:
&amp;nbsp;&amp;nbsp;&amp;nbsp; edit = arcpy.da.Editor(sdeconnection)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "edit created"
&amp;nbsp;&amp;nbsp;&amp;nbsp; edit.startEditing()
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "edit started"
&amp;nbsp;&amp;nbsp;&amp;nbsp; edit.startOperation()
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "operation started"
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Perform edits
&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.InsertCursor(fc, fields) as fc_icursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fc_icursor.insertRow(someNewRow)
&amp;nbsp;&amp;nbsp;&amp;nbsp; edit.stopOperation()
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "operation stopped"
&amp;nbsp;&amp;nbsp;&amp;nbsp; edit.stopEditing(True)&amp;nbsp; ## Stop the edit session with True to save the changes
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "edit stopped"
except Exception as err:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print err
&amp;nbsp;&amp;nbsp;&amp;nbsp; if 'edit' in locals():
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if edit.isEditing:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; edit.stopOperation()
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "operation stopped in except"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; edit.stopEditing(False)&amp;nbsp; ## Stop the edit session with False to abandon the changes
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "edit stopped in except"
finally:
&amp;nbsp;&amp;nbsp;&amp;nbsp; # Cleanup
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.ClearWorkspaceCache_management()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:56:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/proper-arcpy-da-editor-use/m-p/391438#M30937</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-12-11T17:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: Proper arcpy.da.Editor use</title>
      <link>https://community.esri.com/t5/python-questions/proper-arcpy-da-editor-use/m-p/391439#M30938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Revisiting this, I've simplified the code a little by&amp;nbsp;creating the edit session outside the &lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;try...except&lt;/SPAN&gt; so you don't have to check if it exists.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;edit &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Editor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;sdeconnection&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"edit created"&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;try&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    edit&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;startEditing&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"edit started"&lt;/SPAN&gt;
    edit&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;startOperation&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"operation started"&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;# Perform edits&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;with&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;InsertCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fc&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; fields&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; fc_icursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        fc_icursor&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;insertRow&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;someNewRow&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    edit&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;stopOperation&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"operation stopped"&lt;/SPAN&gt;
    edit&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;stopEditing&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token boolean"&gt;True&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;  &lt;SPAN class="comment token"&gt;## Stop the edit session with True to save the changes&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"edit stopped"&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;except&lt;/SPAN&gt; Exception &lt;SPAN class="keyword token"&gt;as&lt;/SPAN&gt; err&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; err
    &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; edit&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;isEditing&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        edit&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;stopOperation&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"operation stopped in except"&lt;/SPAN&gt;
        edit&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;stopEditing&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token boolean"&gt;False&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;  &lt;SPAN class="comment token"&gt;## Stop the edit session with False to abandon the changes&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"edit stopped in except"&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;finally&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="comment token"&gt;# Cleanup&lt;/SPAN&gt;
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ClearWorkspaceCache_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:56:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/proper-arcpy-da-editor-use/m-p/391439#M30938</guid>
      <dc:creator>BlakeTerhune</dc:creator>
      <dc:date>2021-12-11T17:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: Proper arcpy.da.Editor use</title>
      <link>https://community.esri.com/t5/python-questions/proper-arcpy-da-editor-use/m-p/391440#M30939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Blake, that's a lot better and clear than the example in ESRI's doc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 05 Apr 2020 01:07:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/proper-arcpy-da-editor-use/m-p/391440#M30939</guid>
      <dc:creator>Jack_Zhang</dc:creator>
      <dc:date>2020-04-05T01:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: Proper arcpy.da.Editor use</title>
      <link>https://community.esri.com/t5/python-questions/proper-arcpy-da-editor-use/m-p/1215211#M65666</link>
      <description>&lt;P&gt;Does anyone have a an ArcPro 3.0 solution on this??&amp;nbsp; We are using the code above but running&amp;nbsp;arcpy.da.UpdateCursor in stead of&amp;nbsp;&amp;nbsp;InsertCursor.&amp;nbsp; In debug on the&amp;nbsp;arcpy.da.UpdateCursorline we get the error "cannot update the table". Thx&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2022 18:29:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/proper-arcpy-da-editor-use/m-p/1215211#M65666</guid>
      <dc:creator>dbKlingdom</dc:creator>
      <dc:date>2022-09-22T18:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: Proper arcpy.da.Editor use</title>
      <link>https://community.esri.com/t5/python-questions/proper-arcpy-da-editor-use/m-p/1215265#M65669</link>
      <description>&lt;P&gt;Did you set the right booleans for your data?:&lt;/P&gt;&lt;P&gt;Both are defaulted to True, and the second parameter is should be False if your data isnt versioned.&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt;startEditing ({with_undo}, {multiuser_mode})&lt;/STRONG&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;# Edit session is started without an undo/redo stack for versioned data&lt;/SPAN&gt; &lt;SPAN class=""&gt;# (for second argument, use False for unversioned data)&lt;/SPAN&gt; edit.startEditing(&lt;SPAN class=""&gt;False&lt;/SPAN&gt;, &lt;SPAN class=""&gt;True&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/2.8/arcpy/data-access/editor.htm" target="_blank" rel="noopener"&gt;editor.htm&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2022 20:29:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/proper-arcpy-da-editor-use/m-p/1215265#M65669</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2022-09-22T20:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: Proper arcpy.da.Editor use</title>
      <link>https://community.esri.com/t5/python-questions/proper-arcpy-da-editor-use/m-p/1215266#M65670</link>
      <description>&lt;P&gt;Yes we are trying to write to an SQL SDE database.&amp;nbsp; We have set the edit to&amp;nbsp; edit.startEditing(False, True). Thx&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2022 20:34:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/proper-arcpy-da-editor-use/m-p/1215266#M65670</guid>
      <dc:creator>dbKlingdom</dc:creator>
      <dc:date>2022-09-22T20:34:48Z</dc:date>
    </item>
    <item>
      <title>Re: Proper arcpy.da.Editor use</title>
      <link>https://community.esri.com/t5/python-questions/proper-arcpy-da-editor-use/m-p/1629278#M74463</link>
      <description>&lt;P&gt;Try to simplify this further and just use the following.&lt;/P&gt;&lt;P&gt;workspace = "SDEconnection"&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;with&lt;/SPAN&gt;&lt;SPAN&gt; arcpy.da.Editor(workspace):&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;SPAN&gt;# Do your editing here... that's it&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;See more here&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/data-access/editor.htm" target="_blank" rel="noopener"&gt;Editor—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Jul 2025 08:48:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/proper-arcpy-da-editor-use/m-p/1629278#M74463</guid>
      <dc:creator>Bryan_krg</dc:creator>
      <dc:date>2025-07-02T08:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Proper arcpy.da.Editor use</title>
      <link>https://community.esri.com/t5/python-questions/proper-arcpy-da-editor-use/m-p/1667556#M74936</link>
      <description>&lt;P&gt;Revitalizing this thread: because ArcGIS Pro 3.6 and Python 3.13&lt;/P&gt;&lt;P&gt;UPDATE: i figured it out.&amp;nbsp; The edit object has to be created inside the try statement.&amp;nbsp; code block corrected below.&amp;nbsp; Also make sure you run as a geoprocess in the foreground, or you won't see the results.&lt;/P&gt;&lt;P&gt;I was troubleshooting re-appearance in Pro 3.6 of 'workspace already in transaction mode' I worked around successfully in Pro 3.5.x&lt;/P&gt;&lt;P&gt;I'm trying to update a date field to 'now' for all selected features in the active map, which I've set up to trigger each feature class's attribute rules.&amp;nbsp; I finally got the 'workspace' changes dialed-in from the Pro 3.6 env, but I'm running into the old 'workspace already in transaction mode' issue.&lt;/P&gt;&lt;P&gt;This is being run as a Toolbox Script.&lt;/P&gt;&lt;P&gt;I tried 'edit.startEditing(False,False)' and 'edit.startEditing(False,True)' and get the same error.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
from datetime import datetime
import os
import sys
from time import sleep

now = datetime.now()
username = os.environ.get('USERNAME')
nversion = "dbo." + username
lyrsource = r"C:\Gisdata\Projects\ArcGIS_Pro\Projects\TraditionalEditingTesting\SQLServer-androtest-MWWSSB(TestDB).sde\mwwssb.dbo.wserviceconnection"
androtemp_sde = arcpy.Describe(lyrsource).workspace
aprx = arcpy.mp.ArcGISProject("CURRENT")
m = aprx.activeMap
newline = '\n'

def execute():
    if m:
        feature_layers = m.listLayers()

        has_selection = False
        selected_layers = []

        for lyr in feature_layers:
            if lyr.isFeatureLayer:
                selection_set = lyr.getSelectionSet()
                if selection_set:
                    selected_layers.append(lyr.name)
                    has_selection = True

        if not has_selection:
            arcpy.AddError("No selected features detected.")
            sys.exit(0)

        else:
            if has_selection:
                arcpy.AddMessage("Selections found in:" + newline + f"{newline.join(selected_layers)}")
                arcpy.AddMessage(newline)
                for lyr in m.listLayers():
                    if lyr.isFeatureLayer and lyr.getSelectionSet():
                        try:
                            edit = arcpy.da.Editor(androtemp_sde, multiuser_mode=True, version=nversion)
                            edit.startEditing()
                            edit.startOperation()
                            # with edit:
                            cursor = arcpy.da.UpdateCursor(lyr, 'DART')
                            for row in cursor:
                                row[0] = now
                                cursor.updateRow(row)
                                sleep(0.5)
                            del cursor
                            del row
                            arcpy.AddMessage(f"{lyr.name} Updated.")
                            edit.stopOperation()
                            edit.stopEditing(True)
                        except Exception as e:
                            arcpy.AddError(f"Error updating {lyr.name}: {e}")
                            if edit.isEditing:
                                    edit.stopOperation()
                                    arcpy.AddError("operation stopped in exception")
                                    edit.stopEditing(False)  ## Stop the edit session with False to abandon the changes
                                    arcpy.AddError("edit stopped in exception")
                        finally:
                            # Cleanup
                            arcpy.ClearWorkspaceCache_management()
                return
    else:
        arcpy.AddError("No active map.")
        sys.exit(0)


execute()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Nov 2025 18:41:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/proper-arcpy-da-editor-use/m-p/1667556#M74936</guid>
      <dc:creator>MikeRatcliffe</dc:creator>
      <dc:date>2025-11-20T18:41:54Z</dc:date>
    </item>
  </channel>
</rss>

