Norton

Error looping through list for topology deletion?

Discussion created by Norton on Jan 27, 2011
Latest reply on Jan 28, 2011 by rdharles
I have created a short script to iterate through a folder of personal geodatabases, add the full path with topology (located in a feature dataset) to a list, and then call a function to delete the respective topology. PyWin has a problem with the parameters, however. Here's the script:

# Import system modules
import arcpy
import os.path
import shutil
from arcpy import env

# Set environment settings
env.workspace = "C:\Arcwork"

# Set variables for directory locations
mdbwork = "C:\\Arcwork\\parcelmdb"  # Personal Geodatabases stored in this folder

# *********************FUNCTION***********************

# FUNCTION to Delete TOPOLOGY Rule from geodatabase
def delete_topo(deltopo): #define FUNCTION to remove topology from geodatabase
    arcpy.Delete_management(deltopo, "Topology")
    print "Successfully removed topology for" + deltopo # Print a message

# *********************CODE ***************************

# Iterate through each personal geodatabase, calling the delete_topo function
dirlist=os.listdir("C:\\Arcwork\\parcelmdb")
mdblist=[] # Defines the list to hold the full path and topology rule name
for item in dirlist: # Loops through all the contents of the initial diretory
    if item=="GlensFalls.mdb":
     jointopo=os.path.join("C:\\Arcwork\\parcelmdb\\", item, "\\boundary\\boundary_Topology")
    else:
        jointopo=os.path.join("C:\\Arcwork\\parcelmdb\\", item, "\\property\\property_Topology") 
    mdblist.append(jointopo)  # Add variable value to list

for deltopo in mdblist3:       # For each item in the list of geodatabases run function
    delete_topo(deltopo)

_________________________________

Here's the ERROR:
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input Data Element: Dataset \property\property_Topology does not exist or is not supported
Failed to execute (Delete)

Outcomes