AnsweredAssumed Answered

Cost Distance Tool Failure

Question asked by rangermry on Jul 15, 2013
Latest reply on Jul 18, 2013 by rangermry
I have a cost distance tool setup for a batch process.  To take a bunch of inputs from a folder and then use the same cost raster and file saving conventions.  My tool will run but it never runs the process of the cost distance.  It just sits there and does not run.  I tried making it with arcpy the regular way and tried with gp arcpy.  Either way it does the same thing.  Anyone know what I can do to make this run?

#Cost distance for all hubs #by rangermry, 7-11-2013 using Python 2.6.5  import arcpy, os from import * from arcpy import env  #User inputs #Input Rasters Location Folder inputFolder=arcpy.GetParameterAsText(0) #Cost Raster a.k.a. Impedence Layer inCostRaster=arcpy.GetParameterAsText(1)  #Derived inputs #Make output folder #Take input folder name as variable. rootFolName=str(inputFolder.split("\\")[-1]) #Take input folder name off of root folder path. newRoot=inputFolder.replace(rootFolName,"") outputFolder=os.path.join(newRoot,"Cost_Distance") if not os.path.isdir(outputFolder):     os.makedirs(outputFolder)     arcpy.AddMessage("-Folder made for output : "+outputFolder+'\n') #Environmental Workspace env.workspace=inputFolder #Get all Raster Items from inputFolder as workspace rasterList=arcpy.ListRasters() arcpy.AddMessage("-Obtaining all raster inputs\n.")  try:     for rast in rasterList:         if not rast=="imped":             fullpath = os.path.join(inputFolder, rast)             arcpy.AddMessage("-Processing file : "+rast+'\n')             #Set Local Variables             inSourceData=fullpath             outBkLinkRaster=outputFolder+"\\BkLk_"+rast.replace("value","")             outDistRaster=outputFolder+"\\CD_"+rast.replace("value","")             #Execute CostDistance             arcpy.AddMessage("Proceeding to cost distance.\n")             #Check out Spatial Analyst Licesne             arcpy.CheckOutExtension("spatial")   ,inCostRaster,outDistRaster,"",outBkLinkRaster)             arcpy.AddMessage("-Processed file: "+rast+"Saving file...")             arcpy.AddMessage("-Saved file! \n ") except IOError:     #Print traceback error.     tb=sys.exc_info()[2]     tbinfo=traceback.format_tb(tb)[0]     arcpy.AddMessage("PYTHON ERRORS:\nTraceback info: "+tbinfo+"\nError Info:"+str(sys.exc_info()[1]))