arcgis-python-api icon indicating copy to clipboard operation
arcgis-python-api copied to clipboard

cloning Experience Builder WebExperience return json decode error

Open BoudewijnBoogaard opened this issue 2 years ago • 1 comments
trafficstars

Describe the bug Clone experience builder app return JSON decode error in the ArcGIS Online EAC environment (ArcGIS API for Python version 2.2.0.1)

To Reproduce Steps to reproduce the behavior: Login to ArcGIS Online EAC Create a Webmap with just a basemap - I used the Esri OSM basemap Create an Experience Builder app (only map widget using the basemap, set map widget to full screen) clone the experience builder app in ArcGIS Notebooks

from arcgis.apps.expbuilder import WebExperience
from arcgis.gis import GIS
gis = GIS("home")
portal_exp = WebExperience("e60b2effd54145b99445764348888cc4", gis=gis)
we_clone = portal_exp.clone(target=gis, owner='BBoogaard_EAC', search_existing_items=True)

error:

---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
/opt/conda/lib/python3.9/site-packages/requests/models.py in json(self, **kwargs)
    970         try:
--> 971             return complexjson.loads(self.text, **kwargs)
    972         except JSONDecodeError as e:

/opt/conda/lib/python3.9/site-packages/simplejson/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, use_decimal, **kw)
    524             and not use_decimal and not kw):
--> 525         return _default_decoder.decode(s)
    526     if cls is None:

/opt/conda/lib/python3.9/site-packages/simplejson/decoder.py in decode(self, s, _w, _PY3)
    369             s = str(s, self.encoding)
--> 370         obj, end = self.raw_decode(s)
    371         end = _w(s, end).end()

/opt/conda/lib/python3.9/site-packages/simplejson/decoder.py in raw_decode(self, s, idx, _w, _PY3)
    399                 idx += 3
--> 400         return self.scan_once(s, idx=_w(s, idx).end())

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

JSONDecodeError                           Traceback (most recent call last)
/tmp/ipykernel_77/2523714514.py in <cell line: 2>()
      1 portal_exp = WebExperience("e60b2effd54145b99445764348888cc4", gis=gis)
----> 2 we_clone = portal_exp.clone(target=gis, owner='BBoogaard_EAC', search_existing_items=True)
      3 # clone_we(portal_exp)

/opt/conda/lib/python3.9/site-packages/arcgis/apps/expbuilder/expbuilder.py in clone(self, target, owner, **kwargs)
    775         if exp_clone:
    776             new_dict = _clone_dict(self._expdict, self._gis, target, owner, **kwargs)
--> 777             target_exp = WebExperience(exp_clone[0], gis=target)
    778             target_exp._expdict = new_dict
    779             target_exp._item.resources.update(

/opt/conda/lib/python3.9/site-packages/arcgis/apps/expbuilder/expbuilder.py in __init__(self, item, path, gis, template, name)
    144             self._itemid = self._item.itemid
    145             self._resources = self._item.resources.list()
--> 146             self._expdict = self._item.resources.get("config/config.json")
    147             self._draft = self._item.resources.get("config/config.json")
    148             self._gis = self._item._gis

/opt/conda/lib/python3.9/site-packages/arcgis/gis/__init__.py in get(self, file, try_json, out_folder, out_file_name)
   9486             elif resp.headers["Content-Type"].lower().find("json") > -1 and try_json:
   9487                 try:
-> 9488                     return resp.json()
   9489                 except json.JSONDecodeError:
   9490                     return resp.text

/opt/conda/lib/python3.9/site-packages/requests/models.py in json(self, **kwargs)
    973             # Catch JSON-related errors and raise as requests.JSONDecodeError
    974             # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
--> 975             raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
    976 
    977     @property

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Results Both the webmap and experience app are cloned I can view the Experience - seems to use the cloned webmap I cannot edit the experience. It returns an error in the edit application

JSON.parse: unexpected end of data at line 1 column 1 of the JSON data

Screenshots If applicable, add screenshots to help explain your problem.

Expected behavior A clear and concise description of what you expected to happen.

Platform (please complete the following information):

  • ArcGIS Online EAC - October 2023
  • ArcGIS Notebooks in ArcGIS Online EAC
  • ArcGIS API for Python version 2.2.0.1

Additional context The same issue happens when using clone_items()

BoudewijnBoogaard avatar Oct 10 '23 23:10 BoudewijnBoogaard

@nparavicini7 Can you help with this?

nanaeaubry avatar Oct 11 '23 08:10 nanaeaubry

Have addressed this

nparavicini7 avatar Mar 27 '24 22:03 nparavicini7