Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Good Day,

I'm having trouble debugging my python code to create a network analyst layer in ArcGIS 10.0. Basically when run from a script tool the code completes successfully without actually doing anything or returning any sort of useful information, and when run from the embedded python window in ArcGIS 10.0 i get the following error.

"Runtime error : Failed to execute. Parameters are not valid. ERROR 000192: Invalid value for Time Attribute Failed to execute (MakeVehicleRoutingProblemLayer)."

The script is supposed to solve the route and create a layer file for the output Here is my code below:

#Import system modules
import arcpy
from arcpy import env

    #Check out the Network Analyst extension license

    #Set environment settings
    env.workspace = r'C:\Layout3.gdb'
    env.overwriteOutput = True

    #Set local variables
    inNetworkDataset = r'C:\Layout3.gdb\NtsFDS\NtsFDS_ND'
    outNALayerName = "TestResult"

    impedanceAttribute = "CABLE_COST"
    distanceAttribute = "TRAVEL_TIME"
    timeUntis = "Minutes"
    distanceUntis = "Meters"
    inOrders = r'\Layout3.gdb\NtsFDS\Orders'
    inDepots = r'C:\Layout3.gdb\NtsFDS\Depots'
    inRoutes = r'C:\Layout3.gdb\NtsFDS\Route'
    outLayerFile = env.workspace + outNALayerName + ".lyr"

    outNALayer =, outNALayerName,

    outNALayer = outNALayer.getOutput(0)

    subLayerNames =

    ordersLayerName = subLayerNames["Orders"]
    depotsLayerName = subLayerNames["Depots"]
    routesLayerName = subLayerNames["Routes"]

    candidateFields = arcpy.ListFields(inOrders)
    orderFieldMappings =, ordersLayerName,
                                                       False, candidateFields), ordersLayerName, inOrders, orderFieldMappings,"")

    depotFieldMappings =, depotsLayerName), depotsLayerName, inDepots, depotFieldMappings, ""), routesLayerName, inRoutes, "", "")

    #Solve the VRP layer

    #Save the solved VRP layer as a layer file on disk with relative paths,outLayerFile,"RELATIVE")

    print "Script completed successfully"

except Exception as e:
    # If an error occurred, print line number and error message
    import traceback, sys
    tb = sys.exc_info()[2]
    print "An error occured on line %i" % tb.tb_lineno
    print str(e)
share|improve this question
The runtime error occurs when i try to use the MakeVehicleRoutingProblemLayer function – goonerify May 14 '13 at 7:38

For this code to run you will need to upgrade to ArcGIS 10.1 because the ArcPy Network Analyst module ( was only introduced at that release.

share|improve this answer
Thanks but that blows big time... – goonerify May 14 '13 at 13:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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