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\incident_DEV.py", 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.
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))?
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.
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?
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.