Hey All,
I am having a hard time finding a method to check if a version exists. If it exists, I would like to delete it and recreate it
Currently my script uses an inelegant try: except: block, because I don't know how to check to see if a version named "iLOVEtacos" exists. I Instead of expecting a failure condition and dealing with the fallout, I would rather have if: else: statements that look more like this. Can this be accomplished?
import arcpy
import os
ws = os.path.join(os.environ['APPDATA'],"ESRI","Desktop10.2","ArcCatalog", "cfile" + ".sde")
vname = "iLOVEtacos"
vowner = "SDE"
if arcpy.FindVersion(ws, vowner, vname):
arcpy.DeleteVersion_management(ws, vname)
arcpy.CreateVersion_management(ws, "SDE.DEFAULT", vname, "PUBLIC")
Thanks,
Matt