I am doing some error handling on a python script that loads features into a file geodatabase from SDE and then restarts an ArcServer instance. I'm stuck at the point where I try to get the process to run through an inability to delete an old file GDB due to a file lock. Here is the code I am trying (snippet from full script): 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
However this does nothing to prevent the un-handled exception and stops the program from running. Thoughts?