desc0107

python:  how to specify folder within Geoprocessing workspace?

Discussion created by desc0107 on Jul 4, 2011
Latest reply on Jul 8, 2011 by desc0107
I copied only part of the script tool below. For my tool to work the user has to set his Geoprocessing workspace. For most of my script the ouputs go out to the workspace therefore this works great.
----------------------------------------------------------------------------------------------------------
# Assumes user has set the Current Workspace in the Geoprocessing Environment
# In ArcMap, go to: Geoprocessing/Environments/Workspace
# ---------------------------------------------------------------------------
outputRaster= os.path.splitext(inRaster)[0] + "_" + str(No_STDEV) + "STDEV_" + "enh.tif"
#this works and outputs file to workspace
----------------------------------------------------------------------------------------------

Now I would like the ouput to go inside a folder within my workspace. I tried both option below to modify my script but it does not work. Does anyone know how to refer to the workspace in a script connected to a toolbox and add a folder name to it?

outputRaster= "%workspace%/Final_Results/" + os.path.splitext(inRaster)[0] + "_" + str(No_STDEV) + "STDEV_" + "enh.tif"
outputRaster= arcpy.env.workspace + "/Final_Results/" + os.path.splitext(inRaster)[0] + "_" + str(No_STDEV) + "STDEV_" + "enh.tif"

Outcomes