Work Space wrong type Error 000301

07-20-2017 08:39 AM
Occasional Contributor

#Post and Reconcile script:

#My perpetual Error: "Work Space wrong type Error 000301" is frustrating and I need some help. Thank You  

import arcpy
import time, datetime

# Current Day
Day = time.strftime("%m-%d-%Y", time.localtime())
# Current Time
Time = time.strftime("%I:%M:%S %p", time.localtime())

editDB = "Database Connections\\Arden_Admin.sde"
Post_Reconcile_Log1_txt = "\\\\Client\\R$\\Engineering and Planning\\GIS\\813 - Post_Reconcile Log\\Post_Reconcile_Log1.txt"

# Set workspace
workspace = editDB

# Set the workspace environment
arcpy.env.workspace = workspace
arcpy.env.overwriteOutput = True

# Start Time
print 'Process Started at ' + str(Day) + " " + str(Time)

# block new connections to the working and prod database.
print "Blocking Connections..."
arcpy.AcceptConnections(editDB, False)

# disconnect all users from the working and prod database.
print "Disconnecting Users..."
arcpy.DisconnectUser(editDB, "ALL")

#Get a list of all versions besides QAQC and DEFAULT to pass into the ReconcileVersions tool.
ver1List = [ for ver1 in arcpy.da.ListVersions(editDB) if != 'GSWC_SDE.Quality Control' and != 'sde.DEFAULT']
print ver1List

arcpy.ReconcileVersions_management(editDB, "ALL_VERSIONS", "GSWC_SDE_Quality Control", ver1List, "LOCK_ACQUIRED", "ABORT_CONFLICTS", "BY_OBJECT", "FAVOR_EDIT_VERSION", "POST", "KEEP_VERSION", Post_Reconcile_Log1_txt)

# Extract QAQC version from the list of versions to pass to ReconcileVersions tool.
ver2List = [ for ver2 in arcpy.da.ListVersions(editDB) if == 'GSWC_SDE.Quality Control']
print ver2List

arcpy.ReconcileVersions_management(editDB, "ALL_VERSIONS", "sde.DEFAULT", ver2List, "LOCK_ACQUIRED", "ABORT_CONFLICTS", "BY_OBJECT", "FAVOR_EDIT_VERSION", "POST", "KEEP_VERSION", Post_Reconcile_Log1_txt)

#Allow the database to begin accepting connections again
print "Set databases to allow connections..."
arcpy.AcceptConnections(editDB, True)

#My Error message is below:
#Runtime error  Traceback (most recent call last):   File "<string>", line 41, in <module>   File "d:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\", line 16193,
#in ReconcileVersions     raise e ExecuteError: ERROR 000301: The workspace is of the wrong type Failed to execute (ReconcileVersions). 

0 Kudos
3 Replies
Occasional Contributor

Thanks Dan for your response on this:

I reviewed the reference material you suggested and believe it does not apply because I was the Administrator that created the versions. But for argument sake, I did make the changes as specified in the reference material and I was still hit with the same error. Below is a snippet of my changes          

arcpy.ReconcileVersions_management(editDB, "ALL_VERSIONS", ' "domain\laadgate".Quality Control',

' "domain\laadgate".ver1List', "LOCK_ACQUIRED", "ABORT_CONFLICTS", "BY_OBJECT", "FAVOR_EDIT_VERSION", "POST", "KEEP_VERSION", Post_Reconcile_Log1_txt)

0 Kudos
MVP Legendary Contributor

Larry... I think this and your other thread have hit a wall and tech support could probably resolve it since the obvious and less obvious doesn't seem to apply in your case.