Using the following code, I get this error message: "TypeError: ListVersions: Could not open SDE Workspace." import arcpy,os #path to database connections path = "C:\\Documents and Settings\\jwinoker\\Application Data\\ESRI\\Desktop10.0\\ArcCatalog\\" dirs = os.listdir(path) #list of the full paths of SDE databases in Database Connections dbs = [(path + dir) for dir in dirs if dir.endswith(".sde")] for db in dbs: dbName = db.replace(path,"") print(dbName) #print a divider underneath the database Path print("-" * len(dbName)) #for each SDE database, creates a list of its versions versions = arcpy.ListVersions(db) for version in versions: print version # create whitespace between each database and list of versions print("\n")
import arcpy import os #path to database connections path = os.path.join(os.getenv("APPDATA"), r"ESRI\Desktop10.0\ArcCatalog") dirs = os.listdir(path) #list of the full paths of SDE databases in Database Connections dbs = [(os.path.join(path, dir)) for dir in dirs if dir.endswith(".sde")] for db in dbs: dbName = db.replace(path,"") print(dbName) #print a divider underneath the database Path print("-" * len(dbName)) #for each SDE database, creates a list of its versions versions = arcpy.ListVersions(db) for version in versions: print version # create whitespace between each database and list of versions print("\n")
Thanks mzcoyle for the clarification. Do you know off hand if sde connections are stored by default in the "C:\\Documents and Settings\\user\\Application Data\\ESRI\\Desktop10.0\\ArcCatalog\\" folder in XP?
path = os.path.join(os.getenv("APPDATA"), r"ESRI\Desktop10.0\ArcCatalog")
import arcpy,os #path to database connections path = "C:\\Documents and Settings\\jwinoker\\Application Data\\ESRI\\Desktop10.0\\ArcCatalog\\" dirs = os.listdir(path) #list of the full paths of SDE databases in Database Connections dbs = [(path + dir) for dir in dirs if dir.endswith(".sde")] for db in dbs: dbName = db.replace(path,"") print(dbName) #print a divider underneath the database Path print("-" * len(dbName)) #for each SDE database, creates a list of its versions versions = arcpy.ListVersions(db) for version in versions: print version # create whitespace between each database and list of versions print("\n")
versionList = arcpy.ListVersions(path)
versionList = arcpy.ListVersions(db)
import arcpy,os #path to database connections path = "C:\\Users\\jwinoker\\AppData\\Roaming\\ESRI\\Desktop10.0\\ArcCatalog\\" dirs = os.listdir(path) #list of the full paths of SDE databases in Database Connections dbs = [(path + dir) for dir in dirs if dir.endswith(".sde")] for db in dbs: dbName = db.replace(path,"") print(dbName) #print a divider underneath the database Path print("-" * len(dbName)) #for each SDE database, creates a list of its versions versions = arcpy.ListVersions(db) for version in versions: print version # create whitespace between each database and list of versions print("\n")
sde_dir = os.path.join(os.getenv("APPDATA"), r"ESRI\Desktop10.0\ArcCatalog") sde_list = os.listdir(sde_dir) if sde.endswith(".sde"): print sde
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.