Loop error on Network Analyst (ArcGIS 9.3)

Discussion created by lemanlake on Feb 2, 2012
Latest reply on Feb 5, 2012 by DrColgate
Hello everyone,

I am making a loop using the Make Service Area Layer tool of Network Analyst but it doesn't work.
I'd like to make 3 different service areas with 3 different points, each point matching to a facility. A facility is the feature class or layer that is the source for the new network locations. These points call "Armor", "Bouguenais" and "Chantrerie".
My impedance attribute is "Minutes_S1"

And here is my code :

import arcgisscripting
gp = arcgisscripting.create()
gp.AddToolbox("C:/Program Files (x86)/ArcGIS/ArcToolbox/Toolboxes/Network Analyst Tools.tbx")
network = "D:/Travaux/NantesMetropole/Traitements/SIG_Final/Modelisation/voiture/Reseau_Voiture_TOP_ND.nd" 
Armor = "D:/Travaux/NantesMetropole/Traitements/SIG_Final/pts_kml/Pt_Ar.shp"
Bouguenais = "D:/Travaux/NantesMetropole/Traitements/SIG_Final/pts_kml/Pt_Boug.shp"
Chantrerie = "D:/Travaux/NantesMetropole/Traitements/SIG_Final/pts_kml/Pt_Chanr.shp"

facilities_points = ["Armor", "Bouguenais", "Chantrerie"]
while 1:
    for i in facilities_points:
            gp.MakeServiceAreaLayer_na (network, "Service Area_" + i, "Minutes_S1", "TRAVEL_FROM", "10 20 30 40 50", "SIMPLE_POLYS", "MERGE", "DISKS", "NO_LINES", "OVERLAP", "NO_SPLIT", "", "", "ALLOW_UTURNS", "", "TRIM_POLYS", "200 Meters", "NO_LINES_SOURCE_FIELDS")
            gp.AddLocations_na("Service Area_" + i, "Facilities_" + i, i, "", "100 Meters")
            gp.Solve_na ("Service Area_" + i, "HALT")
            gp.CopyFeatures_management("Service Area_" + i + "/Polygons", "D:/Travaux/NantesMetropole/Traitements/SIG_Final/Modelisation/voiture/test_" + i +".shp")
            print "Minutes_S1 done on", i
            print "Error on", i

Actually an error already occurs on line "gp.AddLocations_na" saying :
Error on Armor
Error on Bouguenais
Error on Chantrerie

I checked the ESRI help but I still don't know how to solve my problem. Can you help me ?

Thanks !