Select to view content in your preferred language

ERROR 000837: The workspace is not the correct workspace type

18448
12
11-20-2012 01:14 PM
GaryEhrhardt
Deactivated User
I have a very simple python script that does a compress on one of our enterprise GDB's. The script used to successfully run every night but is now receiving the following error:
"ERROR 000837: The workspace is not the correct workspace type"

There have been 2 recent changes to our environment - one of which must be a contributing factor to this script now erroring out. The first is upgrading from ArcGIS 10.0 SP4 to ArcGIS 10.1 SP1. The other is that we are now running this script on a new server where the old server had 32 bit processing, and the new server is 64 bit.

Here is the script that worked on our old server:

import arcgisscripting
gp = arcgisscripting.create()
gp.toolbox = "management"
gp.compress("Database Connections\sde_loader@bierstadt.sde")

Running the same script on the new server (only change being the db connection) errored out.

I tried updating the python code as follows:

import arcpy
arcpy.ClearWorkspaceCache_management()
arcpy.Compress_management("Database Connections\saxon2_bierstadt_sde_loader.sde")

This also received the same error (000837)

Any ideas on what may be causing this error would be much appreciated.

Gary
12 Replies
MathewCoyle
Honored Contributor
You should use the correct path syntax using a raw string, it shouldn't be a problem in this case but better safe than sorry.

arcpy.Compress_management(r"Database Connections\saxon2_bierstadt_sde_loader.sde")


Are you sure the database connection you are using is an administrator account? Is anyone currently locking any files in the DB?
0 Kudos
GaryEhrhardt
Deactivated User
Matthew,

Thanks for your reply.

I tried using a raw string for my path name to no avail.
I am using an administrator account when running the script.
I am able to successfully use the compress tool (from toolbox), so I don't think that there is a db lock issue.
It's only when I try to compress from the python script that I encounter this maddening error.

Gary
0 Kudos
MathewCoyle
Honored Contributor
Have you set your workspace environment to sde?
0 Kudos
T__WayneWhitley
Honored Contributor
According to the documentation and examples, will it help to use the compress command in conjunction with ClearWorkspaceCache.
Ironically, setting your env workspace var may put a 'hold' on it...so (although this is a 10 example, below link), the workspace cache is cleared just before executing the compress...doesn't quite explain why this is behaving this way now though.

...interesting script example at bottom of page:
http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000000m000000

...use of ClearWorkspaceCache before compress:
http://support.esri.com/en/knowledgebase/techarticles/detail/40657
0 Kudos
T__WayneWhitley
Honored Contributor
Try this:

dbConnect = r'Database Connections\< your sde filename >'
arcpy.env.workspace = ""
arcpy.ClearWorkspaceCache_management(dbConnect)
arcpy.Compress_management(dbConnect)
Ed_Conrad
Occasional Contributor

I interrupted my script while it was compressing the GDB during some testing. Subsequently, I received ERROR 000837 when I reran it. After running the arcpy.ClearWorkspaceCache_management()  function, everything worked fine again.

0 Kudos
GaryEhrhardt
Deactivated User
It turns out that the problem was more of a Microsoft Windows security settings issue. Our new server has a Windows Server 2008 R2 operating system (old server - Windows Server 2003). There's some setting(s) or lack thereof that is preventing the recognition of the "Database Connections" part of the db connection path when accessing via a python script. Haven't resolved that yet but with the help of Umesh from ESRI tech support, I have a workaround that is described below:

Instead of specifying the db connection as "Database Connections\sde_loader@bierstadt.sde"

Obtain the path name on the C drive by right clicking the db connection in ArcCatalog and selecting properties. The path name is on the General tab.

In my case, the name is: C:\Users\ehrhardt\AppData\Roaming\ESRI\Desktop10.1\ArcCatalog\bierstadt_saxon2.sde

Inserted this name into the script, and the script finally worked!

Thank you to Matthew & Wayne for your suggestions and to Umesh for the workaround solution.
BillFarris
Deactivated User

This didn't work for me with 10.2.2.  It tells me error 000837 saying the workspace is not the correct workspace type.  Any ideas? 

0 Kudos
DeeptiVB
Emerging Contributor

Giving the direct C drive link worked for me as well. Thanks for posting the reply, it helped.

0 Kudos