<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic access to ArcGIS Notebook file system - getting error from arcgis.gis.nb.NotebookServer.data_access.files in ArcGIS Notebooks Questions</title>
    <link>https://community.esri.com/t5/arcgis-notebooks-questions/access-to-arcgis-notebook-file-system-getting/m-p/1172225#M543</link>
    <description>&lt;P&gt;I'm trying to access the files from my ArcGIS Notebook. I thought it would be helpful to develop in an IDE on my local system and write a little script to deploy all the file dependencies into /arcgis/home.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can connect to the GIS() via a saved profile, get the Item for my Notebook, get the list of tasks, etc., but I'm stuck on accessing the files. My understanding is that I'm supposed to create a NotebookServer object (&lt;FONT face="courier new,courier" color="#993300"&gt;arcgis.gis.nb.NotebookServer&lt;/FONT&gt;) and its data_access property returns an &lt;FONT face="courier new,courier" color="#993300"&gt;arcgis.gis.nb._dataaccess.NotebookDataAccess&lt;/FONT&gt; object. That has a &lt;FONT face="courier new,courier" color="#993300"&gt;files &lt;/FONT&gt;property and an &lt;FONT face="courier new,courier" color="#993300"&gt;upload()&lt;/FONT&gt; method which should be the rest of what I need.&lt;/P&gt;&lt;P&gt;Here's what I'm trying:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;base_agol_url = 'https://&amp;lt;MY_ORG&amp;gt;.maps.arcgis.com'
gis = GIS(profile='AGOL')
nb_server = NotebookServer(url=base_agol_url, gis=gis)
nb_da = nb_server.data_access
nb_da.files  # THIS LINE FAILS&lt;/LI-CODE&gt;&lt;P&gt;After line 4, I have the &lt;FONT face="courier new,courier" color="#993300"&gt;nb_da&lt;/FONT&gt; variable, which is a&amp;nbsp;&lt;FONT face="courier new,courier" color="#993300"&gt;NotebookDataAccess&lt;/FONT&gt; object and it has all the properties I'd expect.&amp;nbsp;Line 5, however, returns a &lt;FONT face="courier new,courier" color="#993300"&gt;json.decoder.JSONDecodeError&lt;/FONT&gt; with a super lengthy Traceback (see below). To instantiate&amp;nbsp;&lt;SPAN&gt;NotebookServer&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;(line 3), you pass in a URL and a gis object. I assume the URL is the base URL for our AGOL instance, but t&lt;/SPAN&gt;&lt;SPAN&gt;he&amp;nbsp;&lt;SPAN&gt;&lt;FONT face="courier new,courier" color="#993300"&gt;gis &lt;/FONT&gt;object has that URL embedded, so that seems redundant. I tried guessing at a few other URLs on line 3, including&amp;nbsp;&lt;A href="https://notebooksservices.arcgis.com/admin" target="_blank"&gt;https://notebooksservices.arcgis.com/admin&lt;/A&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;but didn't make any progress.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Does anyone have some sample code to create a&amp;nbsp;&lt;FONT face="courier new,courier" color="#993300"&gt;NotebookDataAccess&lt;/FONT&gt; object with a valid set of files? I think once I get that going, I'll be off to the races.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Here is the traceback from line 5 in the code snippet above:&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Traceback (most recent call last):
  File "C:\Users\&amp;lt;USER&amp;gt;\AppData\Local\ESRI\conda\envs\conda_env\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 610, in _handle_response
    data = resp.json()
  File "C:\Users\&amp;lt;USER&amp;gt;\AppData\Local\ESRI\conda\envs\conda_env\lib\site-packages\requests\models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\&amp;lt;USER&amp;gt;\AppData\Local\ESRI\conda\envs\conda_env\lib\json\__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "C:\Users\&amp;lt;USER&amp;gt;\AppData\Local\ESRI\conda\envs\conda_env\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\&amp;lt;USER&amp;gt;\AppData\Local\ESRI\conda\envs\conda_env\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "C:\eclipse\plugins\org.python.pydev.core_7.6.0.202006041357\pysrc\_pydevd_bundle\pydevd_exec2.py", line 3, in Exec
    exec(exp, global_vars, local_vars)
  File "&amp;lt;console&amp;gt;", line 1, in &amp;lt;module&amp;gt;
  File "C:\Users\&amp;lt;USER&amp;gt;\AppData\Local\ESRI\conda\envs\conda_env\lib\site-packages\arcgis\gis\nb\_dataaccess.py", line 102, in files
    for f in self._gis._con.get(url, params).pop("Blobs", [])
  File "C:\Users\&amp;lt;USER&amp;gt;\AppData\Local\ESRI\conda\envs\conda_env\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 506, in get
    ignore_error_key=ignore_error_key,
  File "C:\Users\&amp;lt;USER&amp;gt;\AppData\Local\ESRI\conda\envs\conda_env\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 613, in _handle_response
    raise Exception(resp.text)
Exception: &amp;lt;!DOCTYPE html&amp;gt; 
&amp;lt;html&amp;gt; 
&amp;lt;head&amp;gt; 
  &amp;lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&amp;gt; 
  &amp;lt;link rel="stylesheet" href="https://cdn-a.arcgis.com/cdn/1A3502F/js/calcite-web/dist/css/calcite-web-no-fonts.min.css"&amp;gt; 
  &amp;lt;link rel="stylesheet" href="https://cdn-a.arcgis.com/cdn/1A3502F/js/arcgisonline/css/app.css"&amp;gt; 
&amp;lt;/head&amp;gt; 
&amp;lt;body&amp;gt; 
  &amp;lt;div class="loader is-active padding-leader-5 padding-trailer-5 js-page-loader"&amp;gt; 
    &amp;lt;div class="loader-bars"&amp;gt;&amp;lt;/div&amp;gt; 
    &amp;lt;div class="loader-text"&amp;gt;&amp;lt;/div&amp;gt; 
  &amp;lt;/div&amp;gt; 
  &amp;lt;script type="text/javascript" src="/home/js/arcgisonline/config.js"&amp;gt;&amp;lt;/script&amp;gt; 
  &amp;lt;script src="https://cdn-a.arcgis.com/cdn/1A3502F/js/jsapi/dojo/dojo.js"&amp;gt;&amp;lt;/script&amp;gt; 
  &amp;lt;script&amp;gt; 
    esriGeowConfig.pageNotFound = true; 
    require(window.dojoConfig, ["arcgisonline/main"]); 
  &amp;lt;/script&amp;gt; 
&amp;lt;/body&amp;gt; 
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1202"&gt;@RaviNarayanan&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/115587"&gt;@MobiusSnake&lt;/a&gt;&amp;nbsp;- tag, you guys might know the answer!&lt;/P&gt;</description>
    <pubDate>Mon, 09 May 2022 22:20:54 GMT</pubDate>
    <dc:creator>davedoesgis</dc:creator>
    <dc:date>2022-05-09T22:20:54Z</dc:date>
    <item>
      <title>access to ArcGIS Notebook file system - getting error from arcgis.gis.nb.NotebookServer.data_access.files</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/access-to-arcgis-notebook-file-system-getting/m-p/1172225#M543</link>
      <description>&lt;P&gt;I'm trying to access the files from my ArcGIS Notebook. I thought it would be helpful to develop in an IDE on my local system and write a little script to deploy all the file dependencies into /arcgis/home.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can connect to the GIS() via a saved profile, get the Item for my Notebook, get the list of tasks, etc., but I'm stuck on accessing the files. My understanding is that I'm supposed to create a NotebookServer object (&lt;FONT face="courier new,courier" color="#993300"&gt;arcgis.gis.nb.NotebookServer&lt;/FONT&gt;) and its data_access property returns an &lt;FONT face="courier new,courier" color="#993300"&gt;arcgis.gis.nb._dataaccess.NotebookDataAccess&lt;/FONT&gt; object. That has a &lt;FONT face="courier new,courier" color="#993300"&gt;files &lt;/FONT&gt;property and an &lt;FONT face="courier new,courier" color="#993300"&gt;upload()&lt;/FONT&gt; method which should be the rest of what I need.&lt;/P&gt;&lt;P&gt;Here's what I'm trying:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;base_agol_url = 'https://&amp;lt;MY_ORG&amp;gt;.maps.arcgis.com'
gis = GIS(profile='AGOL')
nb_server = NotebookServer(url=base_agol_url, gis=gis)
nb_da = nb_server.data_access
nb_da.files  # THIS LINE FAILS&lt;/LI-CODE&gt;&lt;P&gt;After line 4, I have the &lt;FONT face="courier new,courier" color="#993300"&gt;nb_da&lt;/FONT&gt; variable, which is a&amp;nbsp;&lt;FONT face="courier new,courier" color="#993300"&gt;NotebookDataAccess&lt;/FONT&gt; object and it has all the properties I'd expect.&amp;nbsp;Line 5, however, returns a &lt;FONT face="courier new,courier" color="#993300"&gt;json.decoder.JSONDecodeError&lt;/FONT&gt; with a super lengthy Traceback (see below). To instantiate&amp;nbsp;&lt;SPAN&gt;NotebookServer&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;(line 3), you pass in a URL and a gis object. I assume the URL is the base URL for our AGOL instance, but t&lt;/SPAN&gt;&lt;SPAN&gt;he&amp;nbsp;&lt;SPAN&gt;&lt;FONT face="courier new,courier" color="#993300"&gt;gis &lt;/FONT&gt;object has that URL embedded, so that seems redundant. I tried guessing at a few other URLs on line 3, including&amp;nbsp;&lt;A href="https://notebooksservices.arcgis.com/admin" target="_blank"&gt;https://notebooksservices.arcgis.com/admin&lt;/A&gt;,&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;but didn't make any progress.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Does anyone have some sample code to create a&amp;nbsp;&lt;FONT face="courier new,courier" color="#993300"&gt;NotebookDataAccess&lt;/FONT&gt; object with a valid set of files? I think once I get that going, I'll be off to the races.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Here is the traceback from line 5 in the code snippet above:&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Traceback (most recent call last):
  File "C:\Users\&amp;lt;USER&amp;gt;\AppData\Local\ESRI\conda\envs\conda_env\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 610, in _handle_response
    data = resp.json()
  File "C:\Users\&amp;lt;USER&amp;gt;\AppData\Local\ESRI\conda\envs\conda_env\lib\site-packages\requests\models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\&amp;lt;USER&amp;gt;\AppData\Local\ESRI\conda\envs\conda_env\lib\json\__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "C:\Users\&amp;lt;USER&amp;gt;\AppData\Local\ESRI\conda\envs\conda_env\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\&amp;lt;USER&amp;gt;\AppData\Local\ESRI\conda\envs\conda_env\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "C:\eclipse\plugins\org.python.pydev.core_7.6.0.202006041357\pysrc\_pydevd_bundle\pydevd_exec2.py", line 3, in Exec
    exec(exp, global_vars, local_vars)
  File "&amp;lt;console&amp;gt;", line 1, in &amp;lt;module&amp;gt;
  File "C:\Users\&amp;lt;USER&amp;gt;\AppData\Local\ESRI\conda\envs\conda_env\lib\site-packages\arcgis\gis\nb\_dataaccess.py", line 102, in files
    for f in self._gis._con.get(url, params).pop("Blobs", [])
  File "C:\Users\&amp;lt;USER&amp;gt;\AppData\Local\ESRI\conda\envs\conda_env\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 506, in get
    ignore_error_key=ignore_error_key,
  File "C:\Users\&amp;lt;USER&amp;gt;\AppData\Local\ESRI\conda\envs\conda_env\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 613, in _handle_response
    raise Exception(resp.text)
Exception: &amp;lt;!DOCTYPE html&amp;gt; 
&amp;lt;html&amp;gt; 
&amp;lt;head&amp;gt; 
  &amp;lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&amp;gt; 
  &amp;lt;link rel="stylesheet" href="https://cdn-a.arcgis.com/cdn/1A3502F/js/calcite-web/dist/css/calcite-web-no-fonts.min.css"&amp;gt; 
  &amp;lt;link rel="stylesheet" href="https://cdn-a.arcgis.com/cdn/1A3502F/js/arcgisonline/css/app.css"&amp;gt; 
&amp;lt;/head&amp;gt; 
&amp;lt;body&amp;gt; 
  &amp;lt;div class="loader is-active padding-leader-5 padding-trailer-5 js-page-loader"&amp;gt; 
    &amp;lt;div class="loader-bars"&amp;gt;&amp;lt;/div&amp;gt; 
    &amp;lt;div class="loader-text"&amp;gt;&amp;lt;/div&amp;gt; 
  &amp;lt;/div&amp;gt; 
  &amp;lt;script type="text/javascript" src="/home/js/arcgisonline/config.js"&amp;gt;&amp;lt;/script&amp;gt; 
  &amp;lt;script src="https://cdn-a.arcgis.com/cdn/1A3502F/js/jsapi/dojo/dojo.js"&amp;gt;&amp;lt;/script&amp;gt; 
  &amp;lt;script&amp;gt; 
    esriGeowConfig.pageNotFound = true; 
    require(window.dojoConfig, ["arcgisonline/main"]); 
  &amp;lt;/script&amp;gt; 
&amp;lt;/body&amp;gt; 
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1202"&gt;@RaviNarayanan&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/115587"&gt;@MobiusSnake&lt;/a&gt;&amp;nbsp;- tag, you guys might know the answer!&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2022 22:20:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/access-to-arcgis-notebook-file-system-getting/m-p/1172225#M543</guid>
      <dc:creator>davedoesgis</dc:creator>
      <dc:date>2022-05-09T22:20:54Z</dc:date>
    </item>
  </channel>
</rss>

