Current Workspace (Environment setting)

Tools that honor the Current Workspace environment use the workspace specified as the default location for geoprocessing tool inputs and outputs.

Usage notes

  • In ArcGIS Pro, the Scratch Workspace and Current Workspace environments default to the project default geodatabase.
  • When using the tool dialog box, output dataset names are autogenerated 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 autogenerated 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 autogenerated output will be the current workspace.
    • If neither the Scratch Workspace nor the Current Workspace environment is set, the autogenerated output path will be the workspace of one of the inputs. In this case, certain restrictions apply. For example, if the workspace is a folder and the output is a new feature class, the output will be a shapefile to the directory above the coverage workspace. There are other restrictions as well, such as write access. In some cases, the output will be written to the system temp directory.
    • If you enter 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.

Dialog syntax

  • Current Workspace—The workspace from which inputs are taken and outputs are placed when running tools.

Scripting syntax

arcpy.env.workspace = path

ParameterExplanation

path

The default location for geoprocessing tool input and output.

workspace syntax

Script example

import arcpy

# Set the workspace environment to local file geodatabase
arcpy.env.workspace = "C:/data/base.gdb"

Related topics