Problem adding data to map after using select and searchcursor.

Discussion created by napugh on Aug 8, 2011
I am using select by location to select data and I then want to display rasters which have their path stored in the table of the selected features.

Here is my code:

import arcpy
import sys
import os.path

settlements = "settlements"
coast = "coast"

arcpy.SelectLayerByLocation_management(settlements, "INTERSECT", coast, "", "NEW_SELECTION")
rows = arcpy.SearchCursor(settlements, 10)

for row in rows:
path = row.getValue("sources")
newlayer = arcpy.MakeRasterLayer_management(path, os.path.basename(path))

It works fine when I run it from the command line but when I try to run it as a tool it only displays the raster for the 1st selected path. I have a derived output variable with multivalue set to yes. Does anyone know why it won't display the rasters for the other selections?