I have 3 shp files stored in a folder (Retailers_0, Retailers_1 and Retailers_2). I want to create a drive time by looping into each file. Below is the code. The problem I'm having is that it only reads the last file Retailers_2. Can anyone point out what's wrong in the code below?
# ---------------------------------------------------------------------------
# TestDT.py
# Created on: Mon Jun 21 2010 01:31:26 PM
# (generated by ArcGIS/ModelBuilder)
# Usage: TestDT <Input_Store_SHP_File> <Enter_Drive_Times> <Select_Drive_Time_Polygon_Output_Path>
# ---------------------------------------------------------------------------
# Import system modules
import sys, string, os, arcgisscripting
# Create the Geoprocessor object
gp = arcgisscripting.create(9.3)
# Load required toolboxes...
gp.CheckOutExtension("Business")
gp.CheckOutExtension("Network")
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Business Analyst Tools.tbx")
for i in range(0,3):
s = str(i)
print s
Input_Store_SHP_File = "H:\\FINANCE\\Analysis\\ESRI\\Sabita\\NewModel\\Test\\Retailers_"+s+".shp"
print Input_Store_SHP_File
# Script arguments...
Enter_Drive_Times = "3" # provide a default value if unspecified
Select_Drive_Time_Polygon_Output_Path = "H:\\FINANCE\\Analysis\\ESRI\\Sabita\\NewModel\\Test\\Result\\Retailers_"+s+".shp"
# Local variables...
Output_Traversed_Streets_Feature_Class = ""
# Process: 1 to 20 min Drive Time...
#tempEnvironment0 = gp.scratchWorkspace
#gp.scratchWorkspace = "H:\\FINANCE\\Analysis\\ESRI\\Sabita\\NewModel\\Test\\Result\\"
gp.DriveTime_ba(Input_Store_SHP_File, "COMPID", "ALL", Enter_Drive_Times, "Minutes", Select_Drive_Time_Polygon_Output_Path, "", "", "false", "false", "false", "true", "false", "false", Output_Traversed_Streets_Feature_Class)
#gp.scratchWorkspace = tempEnvironment0