Skip to content

Conversation

@jsignell
Copy link
Member

@jsignell jsignell commented Jun 28, 2023

Related Issue(s):

Description:

The pystac-client CLI should raise informative errors.

stac-client collections  https://datahub.creodias.eu/stac/
'NoneType' object is not subscriptable
Traceback (most recent call last):
  File "/home/jsignell/pystac-client/pystac_client/cli.py", line 333, in cli
    return collections(client, **args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jsignell/pystac-client/pystac_client/cli.py", line 57, in collections
    collections_dicts = [c.to_dict() for c in client.get_all_collections()]
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jsignell/pystac-client/pystac_client/cli.py", line 57, in <listcomp>
    collections_dicts = [c.to_dict() for c in client.get_all_collections()]
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jsignell/pystac/pystac/catalog.py", line 432, in get_all_collections
    yield from self.get_collections()
  File "/home/jsignell/pystac-client/pystac_client/client.py", line 431, in get_collections
    collection = CollectionClient.from_dict(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jsignell/pystac-client/pystac_client/collection_client.py", line 84, in from_dict
    result = super().from_dict(d, href, root, migrate, preserve_dict)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jsignell/pystac/pystac/collection.py", line 637, in from_dict
    extent = Extent.from_dict(d.pop("extent"))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jsignell/pystac/pystac/collection.py", line 352, in from_dict
    spatial=SpatialExtent.from_dict(d["spatial"]),
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jsignell/pystac/pystac/collection.py", line 120, in from_dict
    bboxes=d["bbox"], extra_fields={k: v for k, v in d.items() if k != "bbox"}
           ~^^^^^^^^
TypeError: 'NoneType' object is not subscriptable

PR Checklist:

  • Code is formatted
  • Tests pass
  • Changes are added to the CHANGELOG

@jsignell jsignell linked an issue Aug 8, 2023 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Aug 8, 2023

Codecov Report

Patch coverage: 52.38% and project coverage change: +0.62% 🎉

Comparison is base (51f76af) 88.05% compared to head (88be99e) 88.67%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #554      +/-   ##
==========================================
+ Coverage   88.05%   88.67%   +0.62%     
==========================================
  Files          13       13              
  Lines         996      989       -7     
==========================================
  Hits          877      877              
+ Misses        119      112       -7     
Files Changed Coverage Δ
pystac_client/cli.py 71.06% <52.38%> (+2.99%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jsignell jsignell requested a review from gadomski August 9, 2023 19:08
@jsignell jsignell enabled auto-merge (squash) August 10, 2023 16:38
@jsignell jsignell merged commit 1454437 into stac-utils:main Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace print statements with appropriate logging Crash on likely non-compliant server

3 participants