The following works in extreem cases where you don't want to recreate anything that is already on disk. If you check for the existance of something then you can choose to not create it as is done below.
#---------------------------------------------------------------------------
# delimita.py
# Created on: Thu Dec 05 2013 07:18:26 AM
#
# Description:
# Es importante que e Modelo de Elevacion tenga Proyeccion UTM, caso contrario, cambie al Sistema de Proyeccion Sugerido
# ---------------------------------------------------------------------------
# Import system modules
import sys, string, os, arcpy#arcgisscripting
# Create the Geoprocessor object
#not used in 10.1
#gp = arcgisscripting.create()
# Check out any necessary licenses
arcpy.CheckOutExtension("spatial")
# Load required toolboxes...
arcpy.AddToolbox(r"C:\Program Files\ArcGIS\Desktop10.1\ArcToolbox\Toolboxes\Spatial Analyst Tools.tbx")
# Set the Geoprocessing environment...
#not used in working example
#arcpy.extent = "DEFAULT"
#The only input variable to this script:
dem = r"C:\Users\Me\Desktop\M130_B90\M130_B90\M130_38076DSQ_BIG.dem"
# downloaded from:
# http://estuarinebathymetry.noaa.gov/bathy_htmls/M130.html
# Local variables...
lleno = r"C:\Users\Me\Desktop\M130_B90\lleno"
direccion = r"C:\Users\Me\Desktop\M130_B90\direccion"
Output_drop_raster = ""
acumula = r"C:\Users\Me\Desktop\M130_B90\acumula"
condicional = r"C:\Users\Me\Desktop\M130_B90\condicional"
Input_true_raster_or_constant_value = "1"
Expression = "Value > 4000"
drenaje = r"C:\Users\Me\Desktop\M130_B90\drenaje.shp"
# Process: Fill...
if not os.path.exists(lleno):
arcpy.Fill_sa(dem, lleno, "")
# Process: Flow Direction...
if not os.path.exists(direccion):
arcpy.FlowDirection_sa(lleno, direccion, "NORMAL", Output_drop_raster)
# Process: Flow Accumulation...
if not os.path.exists(acumula):
arcpy.FlowAccumulation_sa(direccion, acumula, "", "FLOAT")
# Process: Con...
if not os.path.exists(condicional):
arcpy.Con_sa(acumula, Input_true_raster_or_constant_value, condicional, "", Expression)
# Process: Stream to Feature...
if not os.path.exists(drenaje):
arcpy.StreamToFeature_sa(condicional, direccion, drenaje, "SIMPLIFY")
This same method will work for this example, but if you are looking to see if a property exists or if a file geodatabase feature class exists, you will need to use the arcpy.Exists boolean function.I would consider using the script as a toolbox script tool by providing input parameters.for example, arcpy, or in your case:dem = gp.GetParameterAsText(0)
output = gp.SetParemeter)(1)
and then configure the parameter values using the parameters tab of the script tool properties page in arccatalog. I realize you are using arcgis 9.x and it may not work exaclty like this but this should get you going in the right direction.