3

I want to make a very basic python script, however I keep running into error 000714 (general/unknown script error).

The topology is created, the features are added to it, however the rule is not. I've tried different rules, same problem; I will want to add more rules and validation if this error is overcome.

I have tried doing the same process in modelbuilder but the I get error 999999, the syntax is the same when I export the code from it.

Anyone run into this problem or find solution? I am using ArcGIS 10.1.

Code (The script tool's only parameter is a Dataset):

import arcpy, sys
from arcpy import env

env.workspace = sys.argv[1]

topolo = "GBA_Topology"

transLn = "TRANSPORT_LINE"
gbaTransLn = "GBA_TRANSPORT_LINES"

if arcpy.Exists(topolo):
    arcpy.Delete_management(topolo)

arcpy.CreateTopology_management(env.workspace, topolo, "0.001")

arcpy.AddFeatureClassToTopology_management(topolo, transLn, "5", "1")
arcpy.AddFeatureClassToTopology_management(topolo, gbaTransLn, "5", "1")

arcpy.AddRuleToTopology_management(topolo, "Must Not Self-Intersect (Line)", transLn, "", "", "")
1

I believe your error might be that you are not properly referencing the topology after you create it. The following is adopted from a script I wrote; you might want to adapt a few changes and see if that fixes the issue.

#shpin is an input parameter (string)
#rules is an input parameter (list)

scratch = "D:/data"

#Create PGDB and feature dataset for topology and new feature class
gdb = arcpy.CreatePersonalGDB_management(scratch, "tempGDB", "CURRENT")
dataset = arcpy.CreateFeatureDataset_management(gdb, "streets", arcpy.Describe(shpin).spatialReference)

#Import feature class to feature dataset
fclass = arcpy.FeatureClassToFeatureClass_conversion(shpin, dataset, "temporary")

#Create topology and add recently imported FC
topology = arcpy.CreateTopology_management(dataset, "topology", "#")
arcpy.AddFeatureClassToTopology_management(topology, fclass, "1", "1")

#Iterate through list of rules and add each
[arcpy.AddRuleToTopology_management(topology, "{0} (Line)".format(rule),
                                    fclass, "", "", "") for rule in rules]

arcpy.ValidateTopology_management(topology, "Full_Extent")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.