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

7087
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)
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

0 Kudos
7 Replies
BruceBacia
Occasional Contributor
Instead of "mxd" , you want to put the full path of the geodatabase
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.  
0 Kudos
OLANIYANOLAKUNLE
Occasional Contributor II
Thank you that trick did it...
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
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
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
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

0 Kudos