AnsweredAssumed Answered

Python script to a script tool in ArcGIS

Question asked by Deepa1989 on Aug 11, 2020
Latest reply on Aug 13, 2020 by Deepa1989

Hi everyone,

I am new to Python and my question may be very basic  

I would like to convert my python code to a script tool in ArcGIS. The code used is written below and it worked fine and got the output raster named Stak123. But when i make this code into a script tool, i want the output name to be decided by the user who runs the tool. To solve this I was thinking if i add an output folder (Out_Fold) as GetParameterAsText and then in the tool i just put any new name in the output folder for the output raster. But when i ran it  in ArcGIS as a tool I got the message it is completed but could not find the output raster. How to fix this?

import arcpy
import os
import sys
from arcpy import env
from import *
arcpy.env.overwriteOutput = True
env.workspace = r"H:\Stak1108"
arcpy.env.cellSize = "MINOF"
# Assigned paramater as text for the tool
Elevation = arcpy.GetParameterAsText(0)
Out_Fold = arcpy.GetParameterAsText(4)
Raster1 = Raster("Elevation")
# The conditionals were applied in the input rasters
Stak123 = Con(Raster1 = 1,3)........
#Saving the output"H:/Stak1108/Out_Fold/Stak123")