Is there a way to tell the geodatabase version using Python?
I would try the Describe Workspace release property
http://resources.arcgis.com/en/help/main/10.1/index.html#/Workspace_properties/018v0000002v000000/
Here's an ArcObjects + comtypes solution that works for me at 10.0:
import arcpy
from ESRICOMHelpers import GetESRIModule, CType, NewObj
def GetGDBReleaseVersion(gdbPath):
"""Gets the release version of the given geodatabase."""
esriGeoDatabase = GetESRIModule("esriGeoDatabase")
esriGeoprocessing = GetESRIModule("esriGeoprocessing")
gpUtilities = NewObj(esriGeoprocessing.GPUtilities, esriGeoprocessing.IGPUtilities)
try:
dataset = gpUtilities.OpenDatasetFromLocation(gdbPath)
workspace = CType(dataset, esriGeoDatabase.IWorkspace)
gdbRelease = CType(workspace, esriGeoDatabase.IGeodatabaseRelease2)
return "%d.%d" % (gdbRelease.MajorVersion + 7, gdbRelease.MinorVersion)
except:
return None
if __name__ == "__main__":
print GetGDBReleaseVersion(r"C:\GISData\test.gdb")
Output:
>>> 10.0
Grab comtypes here and ESRICOMHelpers here. If you are at 10.1 be sure to tweak comtypes' automation.py
as described in this answer.
Note: Be warned that this also returns 10.0 for 10.1 geodatabases when run from ArcGIS 10.0! Edit: Actually this returns 10.0 for a 10.1 file geodatabase when run from ArcGIS 10.1 as well! Not sure what is going on :|