Select to view content in your preferred language

Why does it think I'm not in an edit session?

4422
8
Jump to solution
12-14-2016 09:30 AM
by Anonymous User
Not applicable

I'm getting this:

Runtime error
Traceback (most recent call last):
  File "<string>", line 3, in <module>
RuntimeError: Objects in this class cannot be updated outside an edit session [GDB_AGR_SECURE.AGR_ADMIN.ApiariesWGS_20160927]

When I run this:

I'm trying to update the point locations based on attributes.

Thanks in advance.

JG

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
MitchHolley1
MVP Regular Contributor

Does it look something like this? 

filepath = r'path to the .sde'
arcpy.env.workspace = filepath

edit = ‍‍‍‍arcpy.da.Editor(filepath)

View solution in original post

8 Replies
MitchHolley1
MVP Regular Contributor

Have you tried setting the env workspace? Current Workspace (Environment setting)—Help | ArcGIS for Desktop 

Right now, your 'workspace' is just a variable.  It's not setting the arcpy.env.workspace.  Also, that workspace is pointing to 'C:\Users\joanna.grossman\AppDate\Roaming\ESRI\Desktop10.4\ArcCatalog'... which I'm pretty sure isn't correct. 

0 Kudos
by Anonymous User
Not applicable

I'm doing that i lines 5-7. =(

0 Kudos
by Anonymous User
Not applicable

hmmm. Seems consistent with examples I've seen, but I'll take a look. Thx.

0 Kudos
by Anonymous User
Not applicable

ok, so I added arcpy.env.workspace = filepath, just for the heck of it and got the same error. Also, just FYI, that connection path is correct...Thanks, tho.

0 Kudos
MitchHolley1
MVP Regular Contributor

Does it look something like this? 

filepath = r'path to the .sde'
arcpy.env.workspace = filepath

edit = ‍‍‍‍arcpy.da.Editor(filepath)
by Anonymous User
Not applicable

aha. It didn't exactly, but I switched to your template and it stopped doing the edit sesh error. It moved onto  "RuntimeError: The version of your database server is not supported." So, now I have another fish to fry. Thanks for your help!

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Try changing line 10 to:

edit = arcpy.da.Editor(filepath)

Line 07 is unnecessary.  Furthermore, you need to pass the full path to the workspace, which is an SDE connection file in this case, and not the directory that contains the workspace.

by Anonymous User
Not applicable

yep, just got there. Thank you!