Skip To Content

Manage content in the user workspace

In the notebook editor, you can work with content in your private ArcGIS Notebook Server workspace to add files to your notebook or download them to your machine. Click the Files button to open the Files pane.

Browse content in the workspace

The Files pane provides a browser for the files in your workspace. The default folders are home and samplesdata (the latter for the data used in the sample notebooks).

Upload content to the workspace

To work with content and resources from your machine, you must first upload your file to your notebook's workspace. Once your files are uploaded, you can reference their file path in your notebook with filepath = /arcgis/home/filename.

To upload files, complete the following steps:

  1. In the Files pane, browse to the /arcgis/home folder.

    Note:
    /arcgis/home is the workspace directory and is different from the root directory home/arcgis.

  2. Click Browse and browse to the file.
  3. Select the file.
  4. Click Upload.

    The file is uploaded to the workspace.

Download content from the workspace

To save a file from the workspace to your local machine, in the Files pane, browse to the file and select it. The file is automatically downloaded to your machine.

Set up a scratch workspace environment for use with ArcPy

The scratch workspace is intended for output data you do not intend to maintain.

To create and use a scratch workspace environment, follow these steps:

  1. Use the code below to create a scratch file geodatabase in the user workspace directory, if it does not already exist, and set the scratch geodatabase as the scratch workspace.

    import arcpy
    if not arcpy.Exists('/arcgis/home/scratch.gdb'):
        arcpy.management.CreateFileGDB('/arcgis/home','scratch.gdb')
    arcpy.env.scratchWorkspace = '/arcgis/home/scratch.gdb'

  2. Use the code below to verify that the geodatabase is set as the scratch geodatabase environment.

    print(arcpy.env.scratchGDB)

Similarly, follow these steps to create a folder to use as a scratch workspace:

  1. Use the code below to create a folder in the user workspace, if one does not already exist, and set that folder as the user workspace.
    import arcpy
    if not arcpy.Exists('/arcgis/home/scratch'):
        arcpy.management.CreateFolder('/arcgis/home', 'scratch')
    arcpy.env.scratchWorkspace = '/arcgis/home/scratch'
  2. Use the code below to verify that the folder is set as the scratch folder environment.
    print(arcpy.env.scratchFolder)