Tools that honor the Current Workspace environment use the workspace specified as the default location for geoprocessing tool inputs and outputs.
- In ArcGIS Pro, the default value for the Scratch Workspace and Current Workspace environments is the project default geodatabase.
- When using the Geoprocessing pane, output dataset names are automatically generated using the Current Workspace and Scratch Workspace environments. The logic for generating the output name is as follows:
- If the Scratch Workspace environment is set, the automatically generated output path will be the scratch workspace.
- If the Scratch Workspace environment is not set, the current workspace environment is examined. If the current workspace is set, the automatically generated output will be the current workspace.
- If neither the Scratch Workspace nor the Current Workspace environment is set, the automatically generated output path will be the workspace of one of the inputs. In this case, certain restrictions apply. For example, the workspace may not have write access. In some cases, the output will be written to the system temp directory.
- If you provide a base name for the output dataset, the Current Workspace environment will be used to construct the output path, regardless of whether the Scratch Workspace environment is set.
- Current Workspace—The workspace from which inputs are taken and outputs are placed when running tools.
arcpy.env.workspace = path
The default location for geoprocessing tool input and output.
import arcpy # Set the workspace environment to local file geodatabase arcpy.env.workspace = "C:/data/base.gdb"