Notebook Server: Working with "local" content.

09-17-2021 03:17 PM
Occasional Contributor II

By "local" content, I mean (mostly) files. JPGs, spreadsheets, text files, etc. These artifacts can be obtained requesting a REST endpoint which can return the contents of a file (the binary)

On ArcGIS Notebook Server I would like to obtain a file's binary, and do something with it, like attach it to a feature. 

According to the documentation ( the attachments.add method requires a path to a file (e.g., C:\\Users\\rohit\\AppData\\Local\\Temp\\AppTemplate.png) , however Notebook Server is not aware of the file system. I've attempted to write the binary to a Python tempfile (, which successfully writes the file but, it's not usable as an attachment.

Notebook Server on AGOL throws an error of :

Exception: Unable to complete operation.
Adding of attachment failed.
(Error Code: 400)

Executing the on ArcGIS Python API on my local box returns an error of:

[WinError 2] The system cannot find the file specified: 'C:\\Users\\XXXXXXX\\AppData\\Local\\Temp\\tmpikjawae3'

tmpikjawae3 is the name of the file in my temp directory

There are tons of other things I'd like to do: carve into text files, create attachments, connect with automations...

Is what I'm asking about possible?

0 Kudos
2 Replies
Occasional Contributor II


I've accomplished this with the ArcGIS REST API and a POST and the import requests

What I'd really like to do is use the Python API for ArcGIS: e.g., cr_lyr.attachments.add(1, 'C:\\Users\\rohit\\AppData\\Local\\Temp\\AppTemplate.png')

0 Kudos
Esri Contributor

Since ArcGIS Notebook Server notebooks run in the context of a Linux container, the two approaches for making files available within the container are to upload to the user's workspace or mount a data directory for all users to access.


Work with content in the user workspace—ArcGIS Notebook Server | Documentation for ArcGIS Enterprise

Configure ArcGIS Notebook Server directories—ArcGIS Notebook Server | Documentation for ArcGIS Enterprise


Hopefully that matches up with what you're trying to accomplish.

-- Chris Pawlyszyn
0 Kudos