Select to view content in your preferred language

Scripting "Create Geometric Network" Syntax Error

627
1
Jump to solution
04-10-2013 07:49 AM
ChristopherClark1
Deactivated User
Once again I have a syntax error that I cannot figure out. It keeps highlighting the end quotation marks which I have made RED.

Thanks for any input. This is my first attempt at scripting GeoNetworks so I could have other errors as well.

# Import arcpy module
import arcpy, sys, traceback
arcpy.env.overwriteOutput = True
from os import path as p

# Define Workspace directory
arcpy.env.workspace = top = r"G:\ChrisGIS\PS_Steelhead\Work"
#
# Create List of all Workspaces (GDB)
try:
    for ws in arcpy.ListWorkspaces("*", "FileGDB"):
        arcpy.env.workspace = ws
        print '\n\nSearching in %s\n\n' %ws
        #
        # Define Variables to be used in processes       
        BARRIERS = p.join(ws, "BARRIERS_MERGED_1")
        SHORE = p.join(ws, "NHD_EndVert_Shore_1")
        NHD = p.join(ws, "NHD_Split_Barriers_1")
        FDS = p.join(ws, "GEONET")
        #
        #
        # Process: Create Geometric Network
        arcpy.CreateGeometricNetwork(FDS, "NETGEO_Net", [BARRIERS "SIMPLE_JUNCTION" "NO", SHORE "SIMPLE_JUNCTION" "NO", NHD "SIMPLE EDGE"], "10", "","","","")
        print '\n\nGeometric Network created in  %s\n\n' %FDS
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ChristopherClark1
Deactivated User
I fixed it the long way. I ran Create Geo Network as a tool for one of my featre datasets, then exported it as a python snippet. Because the features classes have the same names in each of my Datasets, the snippet is correct for all my data. I simply had to change the input Feature Data set to a variable, and it worked.

I think the issue was I was trying to use variables for the "in_source_feature_classes" and it did not jive for some reason.

View solution in original post

0 Kudos
1 Reply
ChristopherClark1
Deactivated User
I fixed it the long way. I ran Create Geo Network as a tool for one of my featre datasets, then exported it as a python snippet. Because the features classes have the same names in each of my Datasets, the snippet is correct for all my data. I simply had to change the input Feature Data set to a variable, and it worked.

I think the issue was I was trying to use variables for the "in_source_feature_classes" and it did not jive for some reason.
0 Kudos