Skip to content

STACError: HREF: <url> does not resolve to a STAC object #1565

Open
@jaiindimple

Description

@jaiindimple

Hello there,
I'm trying to load the Capella static STAC catalog using pystac with the following code:

from pystac import Catalog

root_url = "https://capella-open-data.s3.us-west-2.amazonaws.com/stac/catalog.json"
catalog = Catalog.from_file(root_url)
items = list(catalog.get_all_items())
print(f"Total capella scenes: {len(items)}")

However, I'm facing this error during execution:

18 frames
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 60: ordinal not in range(128)

The above exception was the direct cause of the following exception:

STACError                                 Traceback (most recent call last)
/usr/local/lib/python3.11/dist-packages/pystac/link.py in resolve_stac_object(self, root)
    332                     obj = stac_io.read_stac_object(target_href, root=root)
    333                 except Exception as e:
--> 334                     raise STACError(
    335                         f"HREF: '{target_href}' does not resolve to a STAC object"
    336                     ) from e

STACError: HREF: 'https://capella-open-data.s3.us-west-2.amazonaws.com/stac/capella-open-data-by-capital/capella-open-data-malé/collection.json' does not resolve to a STAC object

The issue seems to be triggered when resolving links with non-ASCII characters (like é). What could be the right way to handle this in pystac.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions