Select to view content in your preferred language

'Could not identify file' updating group thumbnail from URL

280
3
Jump to solution
03-04-2025 01:53 PM
DonMorrison1
Frequent Contributor

This may look like a duplicate post, which @Clubdebambos  solved. But although that solution worked for updating item thumbnailsmy script still fails when trying to update group thumbnails.  Unfortunately there appears to be no equivalent "update_thumbnail" method for the group object.  I updated my test script to target a group:

# To recreate problem
# 1. Update the GROUP_ID variable below to an ArcGIS online group id that you own
# 2. Copy this entire script file and paste it into the ArcGIS Pro (make sure you are signed in)python analysis window, hit enter twice
# 3. Enter run_test()

GROUP_ID = 'e3fb48baf4834208bb545894c3fb7e6a'

from arcgis.gis import GIS
import requests
import os 

def test_upload_as_thumbnail (group, path):
    try:
        group.update(thumbnail = path)
        print (f"Upload {path} to {group.id} as thumbnail succeeded")
    except Exception as ex:
        print (f"Upload {path} to {group.id} as thumbnail failed: {str(ex)}")
    return

def test_download (url):
    if url.lower().startswith('http'):
        try:
            requests.get(url).content
            print (f"Download {url} succeeded")
        except Exception as ex:
            print (f"Download {url} failed: {str(ex)}")
    return

def run_test():
    gis = GIS('pro')
    for url in ['http://maps.fieldmuseum.org/apps/ROWHWG/icons/FeatureLayer.png',             # this one works
                'https://rightofway.erc.uic.edu/wp-content/uploads/FeatureLayer_600_400.png', # this one fails
                'https://rightofway.erc.uic.edu/wp-content/uploads/FeatureLayer.png']:        # this one fails
        test_download (url)
        test_upload_as_thumbnail(gis.groups.get(GROUP_ID), url)


 

 

 

Tags (2)
1 Solution

Accepted Solutions
DonMorrison1
Frequent Contributor

ESRI support basically punted on this.  I was able to work around the problem by adding code to download the images to the local file system then doing the upload from there. 

View solution in original post

0 Kudos
3 Replies
Clubdebambos
MVP Regular Contributor

You should probably report this one 😅  

~ learn.finaldraftmapping.com
0 Kudos
DonMorrison1
Frequent Contributor

Yep - I just opened ESRI Case#03852350.   I'll post back here if anything comes out of it

DonMorrison1
Frequent Contributor

ESRI support basically punted on this.  I was able to work around the problem by adding code to download the images to the local file system then doing the upload from there. 

0 Kudos