2

I am trying to create a script tool in ArcGIS 10.2 in order to incorporate into a model. The script needs to incorporate three inputs which i've built using GetParameterAsText function then setting up the corresponding links within ArcGIS Script Tool Wizard.

However, when I run the script I get ERROR 000714 (see below). Not sure how to handle this error or why it isn't working to begin with.

import arcpy

inFC = arcpy.GetParameterAsText(0)
outFCName = arcpy.GetParameterAsText(1)
outFolder = arcpy.GetParameterAsText(2)
outFC = outFolder + "\\" + outFCName

try:
    if arcpy.Exists(outFC):
        arcpy.Delete_management(outFC)
    arcpy.CreateFeatureclass_management(outFolder,outFCName,"POLYLINE","#","DISABLED","DISABLED",inFC)
    arcpy.AddField_management(outFC,"inFID","LONG","#","#","#","#","NULLABLE","NON_REQUIRED","#")

    iCursor = arcpy.da.InsertCursor(outFC, ["inFID","SHAPE@"])

    print "Starting!"

    with arcpy.da.SearchCursor(inFC,["OID@", "SHAPE@"]) as sCursor:
        for row in sCursor:
            inFID = row[0]
            # Print the current multipoint's ID
            #
            # print("Feature {0}:".format(row[0]))
            partnum = 0

            # Step through each part of the feature
            #
            for part in row[1]:
                # Print the part number
                #
                # print("Part {0}:".format(partnum))

                # Step through each vertex in the feature
                #
                prevX = None
                prevY = None
                for pnt in part:
                    if pnt:
                        # Print x,y coordinates of current point
                        #
                        # print("{0}, {1}".format(pnt.X, pnt.Y))
                        if prevX:
                            array = arcpy.Array([arcpy.Point(prevX, prevY),
                                                 arcpy.Point(pnt.X, pnt.Y)])
                            polyline = arcpy.Polyline(array)
                            iCursor.insertRow([inFID,polyline])
                        prevX = pnt.X
                        prevY = pnt.Y
                    else:
                        # If pnt is None, this represents an interior ring
                        #
                        print("Interior Ring:")
                partnum += 1

    del iCursor

except Exception as e:
    print e.message
    arcpy.AddError(e.message)

print "Complete"

Here is the error:

Executing: SplitLines "F:\Extra Data\Prop Frontage\test_for_py.shp" tester.shp "F:\Extra Data\Prop Frontage"
Start Time: Thu Jan 23 11:38:46 2014
Running script SplitLines...
ERROR 000714: Error in script SplitLines.
Error in executing: cmd.exe /C F:\MASTER~2  "F:\Extra Data\Prop Frontage\test_for_py.shp" "tester.shp" "F:\Extra Data\Prop Frontage"

Failed to execute (SplitLines).
Failed at Thu Jan 23 11:38:46 2014 (Elapsed Time: 0.16 seconds)
14
  • 1
    Just a thought, but shouldn't outFC = outFolder + outFCName be outFC = outFolder + "\\" + outFCName and come after the GetParameterAsText(2) line?
    – Martin
    Commented Jan 23, 2014 at 15:24
  • I tried moving that after the final GetParameterAsText(2) but it didn't solve the error issue.
    – rspencer38
    Commented Jan 23, 2014 at 15:25
  • Are you running this script from ArcMap, ArcCatalog, or as a standalone *.py script from the command prompt? Can we assume that your filename is "SplitLines" by reading the error report? Have you tried running it in DEBUG mode to know which line the error occurs on? Commented Jan 23, 2014 at 15:32
  • SplitLines is the tool name created in ArcMAP. The script was imported into their tool creator in order to integrate into a model. The Model was running perfectly until implementing the GetParameterAsText fields.
    – rspencer38
    Commented Jan 23, 2014 at 15:34
  • 1
    What parameters did you assign for the GetParameterAsText functions?
    – Aaron
    Commented Jan 23, 2014 at 16:30

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.