try: # Delete Old File Geodatabase shutil.rmtree(OldFileGDBPath) print "Deleting Old File Geodatabase..." logging.info("Deleted %s" %(OldFileGDBPath)) # Rename New File Geodatabase os.rename(FileGDBPath, OldFileGDBPath) print "Renaming New File Geodatabase..." logging.info("Renamed %s %s" %(FileGDBPath, OldFileGDBPath)) except (IOError, TypeError, NameError) as e: print "I/O error({0}): {1}".format(e.errno, e.strerror) pass
Solved! Go to Solution.
import os, logging, arcpy OldFileGDBPath = r"C:\temp\python\Old.gdb" FileGDBPath = r"C:\temp\python\New.gdb" try: # Delete Old File Geodatabase arcpy.Delete_management(OldFileGDBPath) print "Deleting Old File Geodatabase..." logging.info("Deleted %s" %(OldFileGDBPath)) # Rename New File Geodatabase arcpy.Rename_management(FileGDBPath, OldFileGDBPath) print "Renaming New File Geodatabase..." logging.info("Renamed %s %s" %(FileGDBPath, OldFileGDBPath)) except Exception as e: print e print "passing error" pass
import os, logging, arcpy OldFileGDBPath = r"C:\temp\python\Old.gdb" FileGDBPath = r"C:\temp\python\New.gdb" try: # Delete Old File Geodatabase arcpy.Delete_management(OldFileGDBPath) print "Deleting Old File Geodatabase..." logging.info("Deleted %s" %(OldFileGDBPath)) # Rename New File Geodatabase arcpy.Rename_management(FileGDBPath, OldFileGDBPath) print "Renaming New File Geodatabase..." logging.info("Renamed %s %s" %(FileGDBPath, OldFileGDBPath)) except Exception as e: print e print "passing error" pass