Hello ,
When I use arcpy.env.scratchFolder in my python script (arcmap 10.7, py 2.7) why is it using my scratch file gbd and not my folder ?
below is the code and image. The script only works when I remove the gbd from the path ?
arcpy.env.overwriteOutput = True
outFolder = arcpy.env.scratchFolder
featureLayer = arcpy.GetParameter(0)
outPutName = arcpy.GetParameterAsText(1)
outputFormat = arcpy.GetParameterAsText(2)
if outputFormat == "kmz":
kmzFile = os.path.join(outFolder, "{0}.kmz".format(outPutName))
arcpy.MakeFeatureLayer_management(featureLayer, outPutName)
arcpy.LayerToKML_conversion(outPutName, (os.path.join(outFolder,outPutName))
arcpy.AddMessage("Success. You can find the kmz in the link below")
arcpy.AddMessage(kmzFile)
elif outputFormat == "shp":
arcpy.AddMessage("shp file")
Thanks
Since you are wanting the user to type a name for the file, you may want set the data type as 'String' for the Name (not 'File'). That way the tool will not help the user locate a file, such as Default.gdb.