AnsweredAssumed Answered

arcpy: Could not open SDE workspace - sde filename dependency?

Question asked by GD_Lionel on Sep 21, 2018
Latest reply on Sep 21, 2018 by bixb0012


I am having trouble with a arcpy script. I'm actuall not that familiar with python in general, and the current issue is really making me sick.

On a new environment, I installed a new Database and I want to setup there the same maintenance task as we already have on another environment. Part of this maintenance is a python script for compress, etc. But on the new environment the scripts aren't working. It always runs into error "TypeError: Could not open SDE workspace"


So I made some tests on the current environment and found some very strange behaviour.

I have the following script (reduced to only few lines)

conn = 'C:\SDE\da.sde'
import arcpy
arcpy.AcceptConnections(conn, True)


the file da.sde exists.

But when I rename the file to test.sde, and change it of course in the pythin script, it throws:


Traceback (most recent call last):
  File "C:\SDE\", line 5, in <module>
    arcpy.AcceptConnections(conn, True)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\", line
 1677, in AcceptConnections
    return gp.acceptConnections(sde_workspace, accept_connections)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\geoprocessing\_bas", line 479, in acceptConnections
    return self._gp.AcceptConnections(sde_workspace, accept_connections)
TypeError: Could not open SDE workspace.

(This is also the actual error I always get on the other environment.)

Switching both back to da.sde, works again.


I've testes several different filenames.

"da.sde" - works!

"test.sde" - fail

"datest.sde" - works

"abcde.sde" - fail

"wtf.sde" - works

"lmgtfy.sde" - works

"prod_sde.sde" - works

"b_prod_sde.sde" - fails


I am not sure that the nameing is related to the issue on the other environment. But I got a little desperate with it, so that I hope unterstanding the nameing issue, may help me to make the script run elsewhere.