Can't update content item data in a folder

509
1
08-29-2022 02:07 PM
FredSpataro
Occasional Contributor III

HI, 

My script to update a content item data (file) fails when the item is in a folder.  Seems like i might be missing something simple but can't figure out what.  

Setup:

  • ArcGIS API for Python 2.0.1
  • Enterprise portal v 10.9.1 ... seems to work with AGOL
  • Content item (tpk file) published/upload as simple file not as layer
  • I can reproduce with the simple code below in the ArcPro python window 
  • Works fine if the item is in the owner root but fails when item is put into a folder
  • Error:Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "D:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 12961, in update
        status = self._gis.content._add_by_part(
      File "D:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 5102, in _add_by_part
        path += "/" + folder_id
    TypeError: can only concatenate str (not "NoneType") to str
  • Code:

 

from arcgis.gis import GIS
gis = GIS('home')	
id = '{item_guid_here}'
existing_tpk = gis.content.get(id)
tpk_path = r'C:\{my_new_awesome_file_here}.tpk'
existing_tpk.update(data=tpk_path)

 

0 Kudos
1 Reply
FredSpataro
Occasional Contributor III

Tech support has verified the issue as bug in 2.0.1: BUG-000152141

Tags (1)