How can i start the edit session for a layer warehoused in a geodatabase

6109
7
Jump to solution
08-30-2012 10:00 PM
OLANIYANOLAKUNLE
Occasional Contributor II
This is the runtimeerror i get anytime i try to start an edit session for my layers warehoused in a geodatabase;


>>> edit = arcpy.da.Editor(mxd) Runtime error  Traceback (most recent call last):   File "<string>", line 1, in <module> RuntimeError: cannot open workspace >>> 


Please how can i overwhelm this problem of mine? Thanks
Tags (2)
Reply
0 Kudos
1 Solution

Accepted Solutions
BruceBacia
Occasional Contributor
Here is an example:

gdb = r"C:\AllMyLayers.gdb" edit = arcpy.da.editor(gdb) edit.startEditing()      #you may want to adjust the parameters here.  You can read up on the documentation  ---whatever you want to do in your editing session  edit.stopEditing()     #again, you may want to adjust the save parameter.  

View solution in original post

Reply
0 Kudos
7 Replies
BruceBacia
Occasional Contributor
Instead of "mxd" , you want to put the full path of the geodatabase
Reply
0 Kudos
BruceBacia
Occasional Contributor
Here is an example:

gdb = r"C:\AllMyLayers.gdb" edit = arcpy.da.editor(gdb) edit.startEditing()      #you may want to adjust the parameters here.  You can read up on the documentation  ---whatever you want to do in your editing session  edit.stopEditing()     #again, you may want to adjust the save parameter.  

View solution in original post

Reply
0 Kudos
OLANIYANOLAKUNLE
Occasional Contributor II
Thank you that trick did it...
Reply
0 Kudos
OLANIYANOLAKUNLE
Occasional Contributor II
I want to pass the selection query below for a layer in my Geodatabase, how can i get i to be like the second query, the 1st 1 is not working;

arcpy.SelectLayerByAttribute_management("Parcels", "NEW_SELECTION", '"TDPDetails"' + "=" + "'" + selection + "'")



arcpy.SelectLayerByAttribute_management("Parcels", "NEW_SELECTION", [TDPDetails] + "=" + "'" + selection + "'")



How can i replace "TDPDetails" with [TDPDetails]?

Thanks
Reply
0 Kudos
OLANIYANOLAKUNLE
Occasional Contributor II
How can i start the edit session for a layer warehoused in an ArcSDE geodatabase, I have moved my geodatabase to an ArcSDE geodatabase and ive been trying to start editing and it is giving me the error below; Please how do i go about this. Thanks

 gds = r"C:/Users/Administrator/AppData/Roaming/ESRI/Desktop10.1/ArcCatalog/GISSERVER_SQLEXPRESS.gds/KWAGISMAIN"
edit = arcpy.da.Editor(gds)
Runtime error
Traceback (most recent call last):
  File "<string>", line 1, in <module>
RuntimeError: cannot open workspace
Reply
0 Kudos
GreggPitts
New Contributor
Hi, I'm using Addin Assistant to make a button that will cycle edit sessions but I see that ArcPy wants the exact location of the GDB... Can I use a variable or function to pick up the layers that are visible so the user can cycle through those? They could be anything, anywhere... SDE, FGDB, PGDB etc...


Thanks,
Gregg
Reply
0 Kudos
MartinHvidberg
Occasional Contributor

What you want is likely an 'Editor' object

ArcGIS Help (10.2, 10.2.1, and 10.2.2)

.. resources.arcgis.com/en/help/main/10.2/index.html#//00s300000008000000

/Martin

Reply
0 Kudos