I am wanting to create a version, step into the version, make edits, and then post and reconcile that version. When I get to the ReconcileVersions_management tool, it is giving me
ERROR 000301: The workspace is of the wrong type
I think that might mean "the version is locked for editing" or "the connection to the db is still open--we can't operate on it". I'm posting my long-ish code, looking for answers.
import arcpy import os from datetime import datetime # make a connection to SDE.DEFAULT try: filename1 = "fn1" foldername1 = os.path.join(os.environ['APPDATA'],"ESRI","Desktop10.2","ArcCatalog") servername1 = "gissvc" servicename1 = "sde
racle11g:GISDEVR" dbname1 = "" auth1 = "" un1 = "MyUser" pass1 = "MyPass" userinfo1 = "" ver1 = "SDE.DEFAULT" sv1 = "SAVE_VERSION" if os.path.isfile(os.path.join(os.environ['APPDATA'],"ESRI","Desktop10.2","ArcCatalog", filename1 + ".sde")): os.remove(os.path.join(os.environ['APPDATA'],"ESRI","Desktop10.2","ArcCatalog", filename1 + ".sde")) print "creating connection to " + ver1 arcpy.CreateArcSDEConnectionFile_management(foldername1, filename1, servername1, servicename1, dbname1, auth1, un1, pass1, userinfo1, ver1, sv1) ws1 = os.path.join(os.environ['APPDATA'],"ESRI","Desktop10.2","ArcCatalog", filename1 + ".sde") ver2 = "net_edits" # create a version for version in arcpy.da.ListVersions(ws1): if ver2 in version.name: print ver2 + " exists, deleting" arcpy.DeleteVersion_management(ws1, version.name) print "creating new version, " + ver2 arcpy.CreateVersion_management(ws1, "SDE.DEFAULT", ver2, "PUBLIC") # connect to new version filename2 = "fn2" foldername2 = os.path.join(os.environ['APPDATA'],"ESRI","Desktop10.2","ArcCatalog") servername2 = "gissvc" servicename2 = "sde
racle11g:GISDEVR" dbname2 = "" auth2 = "" un2 = "MyUser" pass2 = "MyPass" userinfo2 = "" #ver2 = "net_edits" sv2 = "SAVE_VERSION" if os.path.isfile(os.path.join(os.environ['APPDATA'],"ESRI","Desktop10.2","ArcCatalog", filename2 + ".sde")): os.remove(os.path.join(os.environ['APPDATA'],"ESRI","Desktop10.2","ArcCatalog", filename2 + ".sde")) print "creating connection to " + ver2 arcpy.CreateArcSDEConnectionFile_management(foldername2, filename2, servername2, servicename2, dbname2, auth2, un2, pass2, userinfo2, ver2, sv2) ws2 = os.path.join(os.environ['APPDATA'],"ESRI","Desktop10.2","ArcCatalog", filename2 + ".sde") # edit some things -- select where status = 5, change to "tacos" tbl_vw = "t" where = 'STATUS = 5' arcpy.MakeTableView_management(os.path.join(ws2, "fooditems"), tbl_vw, where, "", "") arcpy.CalculateField_management(tbl_vw, "STATUS", '"tacos"') # close connections arcpy.ClearWorkspaceCache_management() print arcpy.GetMessages() # reconcile with post reclogname = "reconcile_log_" + str(datetime.now().strftime('%Y-%m-%d')) + ".txt" reclog = os.path.join("F:\PythonScripts","ErrorLogFiles",reclogname) if os.path.isfile(reclog): os.remove(reclog) print "reconciling with post and delete_version options set" arcpy.ReconcileVersions_management(ws2, "ALL_VERSIONS", "SDE.Default", ver2, "LOCK_ACQUIRED", "ABORT_CONFLICTS", "BY_OBJECT", "FAVOR_TARGET_VERSION", "POST", "DELETE_VERSION", reclog) except Exception as e: print e.message
أكثر...
ERROR 000301: The workspace is of the wrong type
I think that might mean "the version is locked for editing" or "the connection to the db is still open--we can't operate on it". I'm posting my long-ish code, looking for answers.
import arcpy import os from datetime import datetime # make a connection to SDE.DEFAULT try: filename1 = "fn1" foldername1 = os.path.join(os.environ['APPDATA'],"ESRI","Desktop10.2","ArcCatalog") servername1 = "gissvc" servicename1 = "sde
أكثر...