Hi,
i make script who uses arcpy toolboxes and makes lot of output files. I set the scrath workspace for this outputs.
i have noticed, that:
arcpy.CopyFeatures_management('TreesP')
i can do not write output file name and its goes to scrath workspace, and it is nice.
But for:
arcpy.Buffer_analysis('TreesP', '', '2 Meters')
arpy do not let me not write output name and if i write it, than output goes to current workspace(not scrach).
How to make: i do not write output name and its goes to scrath workspace?
Thanks!
Solved! Go to Solution.
Are the names you are passing layer/table view names or data set names? If the latter, just don't. When passing data sets, it is best to pass the full path and not rely on whatever workspaces you may or may not have set to find the data sets based solely on a name. Passing the full path makes the code more readable and reduces the risk of running into gremlins with how various geoprocessing tools handle finding data sets.
I recommend using CreateScratchName—ArcMap | Documentation (arcgis.com)
At the bottom of each tools help there is a list of the environments that each tool supports
environment-settings/scratch-workspace
In your examples both support the scratch workspace, but there is no environment setting not to supply a name.
data-management/copy-features
Environments
Current Workspace, Scratch Workspace,
and
analysis/buffer
Environments
"memory" workspace is nice, but for ArcGIS Pro, but i have Desctop 10.6
Are the names you are passing layer/table view names or data set names? If the latter, just don't. When passing data sets, it is best to pass the full path and not rely on whatever workspaces you may or may not have set to find the data sets based solely on a name. Passing the full path makes the code more readable and reduces the risk of running into gremlins with how various geoprocessing tools handle finding data sets.
I recommend using CreateScratchName—ArcMap | Documentation (arcgis.com)