<?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 Error when using upload function to migrate local Experience to Enterprise Portal in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/error-when-using-upload-function-to-migrate-local/m-p/1623493#M11448</link>
    <description>&lt;P&gt;I need to migrate many Experience Builder Developer applications to our new Enterprise Portal and thought I found a somewhat automated approach using ArcGIS API for Python.&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/latest/guide/experience-builder-workflows/" target="_blank"&gt;https://developers.arcgis.com/python/latest/guide/experience-builder-workflows/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The upload function, however, is throwing an error and I can't make any sense of it. Here is the code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.apps.expbuilder import WebExperience
from arcgis.gis import GIS

#Establish a GIS connection to the target portal.
target_portal = GIS("https://gistest.name.com/portal", "myuser.name")
print(target_portal)
Enter password: ········
GIS @ https://gistest.name.com/portal version:2024.1

# pass in a path to a local config.json when instantiating experience
local_path = r"C:\WebDev\EBv1.16\downloaded-apps\myexbapp\cdn\3\config.json"
local_exp = WebExperience(gis=target_portal, path=local_path)
local_exp.datasources
Output {'dataSource_2': {'id': 'dataSource_2', 'type': 'WEB_MAP', 'sourceLabel': 'Fish Range Search Map', 'itemId': '0f727a3fa60c42bea404xxxxxx', 'portalUrl': ......}

new_item = local_exp.upload(
    gis=target_portal,
    publish=False,
    title="Fish Range Finder Test",
    auto_remap=True)
new_item

throws error:
NameError                                 Traceback (most recent call last)
In  [49]:
Line 1:     new_item = local_exp.upload(

File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\apps\expbuilder\expbuilder.py, in upload:
Line 783:   test_gis = GIS(url=url)

NameError: name 'GIS' is not defined
---------------------------------------------------------------------------
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone tell me what I am doing wrong here? I don't know what 'GIS' name the error is referring to. The GIS module is defined and if it wasn't I would be getting an error in the first code block.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Jun 2025 16:35:05 GMT</pubDate>
    <dc:creator>FranklinAlexander</dc:creator>
    <dc:date>2025-06-13T16:35:05Z</dc:date>
    <item>
      <title>Error when using upload function to migrate local Experience to Enterprise Portal</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/error-when-using-upload-function-to-migrate-local/m-p/1623493#M11448</link>
      <description>&lt;P&gt;I need to migrate many Experience Builder Developer applications to our new Enterprise Portal and thought I found a somewhat automated approach using ArcGIS API for Python.&amp;nbsp;&lt;A href="https://developers.arcgis.com/python/latest/guide/experience-builder-workflows/" target="_blank"&gt;https://developers.arcgis.com/python/latest/guide/experience-builder-workflows/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The upload function, however, is throwing an error and I can't make any sense of it. Here is the code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.apps.expbuilder import WebExperience
from arcgis.gis import GIS

#Establish a GIS connection to the target portal.
target_portal = GIS("https://gistest.name.com/portal", "myuser.name")
print(target_portal)
Enter password: ········
GIS @ https://gistest.name.com/portal version:2024.1

# pass in a path to a local config.json when instantiating experience
local_path = r"C:\WebDev\EBv1.16\downloaded-apps\myexbapp\cdn\3\config.json"
local_exp = WebExperience(gis=target_portal, path=local_path)
local_exp.datasources
Output {'dataSource_2': {'id': 'dataSource_2', 'type': 'WEB_MAP', 'sourceLabel': 'Fish Range Search Map', 'itemId': '0f727a3fa60c42bea404xxxxxx', 'portalUrl': ......}

new_item = local_exp.upload(
    gis=target_portal,
    publish=False,
    title="Fish Range Finder Test",
    auto_remap=True)
new_item

throws error:
NameError                                 Traceback (most recent call last)
In  [49]:
Line 1:     new_item = local_exp.upload(

File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\apps\expbuilder\expbuilder.py, in upload:
Line 783:   test_gis = GIS(url=url)

NameError: name 'GIS' is not defined
---------------------------------------------------------------------------
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone tell me what I am doing wrong here? I don't know what 'GIS' name the error is referring to. The GIS module is defined and if it wasn't I would be getting an error in the first code block.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jun 2025 16:35:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/error-when-using-upload-function-to-migrate-local/m-p/1623493#M11448</guid>
      <dc:creator>FranklinAlexander</dc:creator>
      <dc:date>2025-06-13T16:35:05Z</dc:date>
    </item>
  </channel>
</rss>

