Select to view content in your preferred language

Why is arcpy.env.scratchFolder using my gdb scratch

550
1
09-28-2020 09:17 AM
by Anonymous User
Not applicable

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

0 Kudos
1 Reply
RandyBurton
MVP Alum

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.

0 Kudos