<?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 Re: Layer inaccessible from Notebook in ArcGIS Notebooks Questions</title>
    <link>https://community.esri.com/t5/arcgis-notebooks-questions/layer-inaccessible-from-notebook/m-p/1486491#M769</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/557131"&gt;@LNX&lt;/a&gt;&amp;nbsp;Did you ever figure this out? I have a hosted feature layer collection that is publicly available but hosted on another portal than the one I need to use to run a scheduled notebook. Depending on the script I try to use, I either get "Error executing tool" or the same one your do. I can run the same script in a notebook in ArcGIS Pro (3.3) with the feature layers added to a map, but it won't work if the layers aren't added to a map. I can't figure out what's necessary to make it work in a hosted notebook... help?&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jun 2024 17:58:07 GMT</pubDate>
    <dc:creator>LMedeirosUI</dc:creator>
    <dc:date>2024-06-06T17:58:07Z</dc:date>
    <item>
      <title>Layer inaccessible from Notebook</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/layer-inaccessible-from-notebook/m-p/1360860#M711</link>
      <description>&lt;P&gt;I have a script that imports both arcpy and arcgis modules.&amp;nbsp; It works when I run it locally in VS Code, but we need to run it as&amp;nbsp; Notebook in a specific Portal environment.&amp;nbsp; I created an Advanced Notebook since that's required to import arcpy, but the script fails on a specific arcpy function.&lt;/P&gt;&lt;P&gt;This code block is where the error occurs.&amp;nbsp; I'm passing the URL for a hosted feature layer into the MakeFeatureLayer function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;mission_tracks_layer = arcpy.MakeFeatureLayer_management(feature_layer.url, layer_name, where)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the advanced Notebook it throws this error (edited to hide the actual URL):&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;ExecuteError&lt;/SPAN&gt;: Failed to execute. Parameters are not valid.
ERROR 000732: Input Features: Dataset &lt;A href="https://ht.qfusion.us/server/rest/services/Hosted/HTJCOE_Mission_Tracks_All/FeatureServer/3" target="_blank" rel="noopener"&gt;https://&amp;lt;redacted stuff&amp;gt;Mission_Tracks_All/FeatureServer/3&lt;/A&gt; does not exist or is not supported
Failed to execute (MakeFeatureLayer).&lt;/PRE&gt;&lt;P&gt;I got this same error previously while developing and debugging the script in VS Code.&amp;nbsp; I fixed it by launching ArcGIS Pro on the local machine which initializes the license.&amp;nbsp; After that it worked.&lt;/P&gt;&lt;P&gt;I find it odd that I'm facing this same error again even though I'm now running the script as an advanced Notebook within the same Portal environment where the hosted feature layer is hosted and owned.&amp;nbsp; Do I need to somehow initialize the arcpy license in the Notebook?&lt;/P&gt;&lt;P&gt;Things I've tried in Portal that haven't worked:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Made sure the hosted feature layer has editing enabled&lt;/LI&gt;&lt;LI&gt;Made sure the hosted feature layer is shared with the org&lt;/LI&gt;&lt;LI&gt;Initialized the arcgis module by logging in as the owner of the hosted feature layer&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I get the same error whether I connect to the portal either of these two ways:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;gis = GIS(arcgis_portal_url, owner_username, owner_password)
#or
gis = GIS("home")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Final thought - the reason we are needing to convert a hosted feature layer to a "local" feature layer with arcpy is because we're calling a function from arcpy.intelligence that can only operate on local data, not a hosted feature layer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Thu, 14 Dec 2023 14:29:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/layer-inaccessible-from-notebook/m-p/1360860#M711</guid>
      <dc:creator>LNX</dc:creator>
      <dc:date>2023-12-14T14:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: Layer inaccessible from Notebook</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/layer-inaccessible-from-notebook/m-p/1486491#M769</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/557131"&gt;@LNX&lt;/a&gt;&amp;nbsp;Did you ever figure this out? I have a hosted feature layer collection that is publicly available but hosted on another portal than the one I need to use to run a scheduled notebook. Depending on the script I try to use, I either get "Error executing tool" or the same one your do. I can run the same script in a notebook in ArcGIS Pro (3.3) with the feature layers added to a map, but it won't work if the layers aren't added to a map. I can't figure out what's necessary to make it work in a hosted notebook... help?&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 17:58:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/layer-inaccessible-from-notebook/m-p/1486491#M769</guid>
      <dc:creator>LMedeirosUI</dc:creator>
      <dc:date>2024-06-06T17:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: Layer inaccessible from Notebook</title>
      <link>https://community.esri.com/t5/arcgis-notebooks-questions/layer-inaccessible-from-notebook/m-p/1512894#M812</link>
      <description>&lt;P&gt;You need to actually login to arcpy within the notebook. Place this code in the get started section of the script:&lt;BR /&gt;&lt;BR /&gt;`&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from datetime import datetime

def arcpy_SignInToPortal() -&amp;gt; None:
    signed_in = arcpy.SignInToPortal("notebook")
    expires = signed_in.get("expires")
    expire_time = datetime.fromtimestamp(expires)
    current_time = datetime.now()
    print("ArcPy is signed in to the current organization.\n"
          f"The token is expiring at {expire_time}.\nThe current time is {current_time}.")

arcpy_SignInToPortal()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2024 12:38:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-notebooks-questions/layer-inaccessible-from-notebook/m-p/1512894#M812</guid>
      <dc:creator>JessicaLott_Dymaptic</dc:creator>
      <dc:date>2024-07-31T12:38:02Z</dc:date>
    </item>
  </channel>
</rss>

