Arcpy.da.Editor running on Server Error

01-15-2019 01:16 PM
New Contributor II

I have a script that I am trying to run on an Application server that has Server Manager installed. It only has Python Arcpy 64-bit installed on it. Everything runs fine on my local machine which is where I have been doing testing.

It seems the arcpy.da.Editor cannot be started when running on ArcGIS Server.

   Here are the steps the script is suppose to do:

         1. Set the workspace with a .sde file

         2. Create the arcpy.da.Editor object

         3. Start editing session

         4. Use the arcpy.da.UpdateCursor to update a field

         5. Stop the editing session

Nothing fancy, but getting the script to run on the server seems to be the issue.

Here is the error I get from the Python IDLE

Traceback (most recent call last):
File "D:\Scripts\", line 65, in <module>
edit = arcpy.da.Editor(dev_workspace) # Start an edit session
RuntimeError: cannot open workspace

Attached is the script I am trying to run. 

Any thoughts are appreciated.

0 Kudos
6 Replies
MVP Honored Contributor

Presumably we can simplify your script to this to replicate the error:

import arcpy
dev_workspace = arcpy.env.workspace = r'\\nttafs1\ARCGIS\SDE Connections\NTTASDBDV3_SDE_Admin.sde'
edit = arcpy.da.Editor(dev_workspace)

What do you get when you print(arcpy.Describe(dev_workspace))?

0 Kudos
New Contributor II

My results:

0 Kudos
MVP Esteemed Contributor

As I mentioned/asked yesterday, what credentials are being used by the server to connect.  Is the SDE conn file setup for OS authentication?

0 Kudos
MVP Esteemed Contributor

When you make a call to ArcPY, it needs to be able to run it via ArcGIS.  For example, we have a server that basically works the night shift. During the day it just sits idle but at night it runs our administrative ArcPy scripts. However it has a full blown install of ArcGIS on it, and gets licensed from or license server.

That should just about do it....
0 Kudos
MVP Esteemed Contributor

The error message indicates that the process running the script on the server cannot access the workspace.  What account are you running ArcGIS Server with?  And, do those credentials have access to the network file share where the SDE conn file is stored?

0 Kudos
New Contributor II

Thanks to everyone's responses, we were able to successful find the fix to the error. Joshua's comment gave me a reminder to check the user that Server is using. We figured out the dev environment is completed messed up and I was trying to get the script running on the dev server. 

I switched everything to our test environment.

Checked the Services under Administrative Tools to see which user is used for keeping ArcGIS Server running. We use a Group Service Account (gMSA) with no password.

Then I went into SQL Server Management Studio to add that gMSA account to have access to the Test SDE

Used the code that Darren mentioned to check if I can even run the code in the Python command line. That worked.

I then ran the script with Python IDLE and everything checked out. Now I don't need to install ArcGIS Desktop and use up a license. The script will use the ArcGIS Server license.