arcpy toolboxes auto generate output name to the scratch workspaces

1313
4
Jump to solution
11-21-2020 08:26 AM
by Anonymous User
Not applicable

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!

 

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
JoshuaBixby
MVP Esteemed Contributor

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)

 

View solution in original post

0 Kudos
4 Replies
DanPatterson
MVP Esteemed Contributor

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 WorkspaceScratch Workspace,  

and
analysis/buffer 
Environments

 
If you don't need the results, or they are temporary, consider using the "memory" workspace

... sort of retired...
by Anonymous User
Not applicable

"memory" workspace is nice, but for ArcGIS Pro, but i have Desctop 10.6

Tags (2)
0 Kudos
DanPatterson
MVP Esteemed Contributor

check your help files

the-in-memory-workspace 


... sort of retired...
0 Kudos
JoshuaBixby
MVP Esteemed Contributor

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)

 

0 Kudos