Skip to content

cannot unpack non-iterable STACVersionRange object #338

@sachinlionel

Description

@sachinlionel

validate dict is throwing this error
TypeError: cannot unpack non-iterable STACVersionRange object
with stac_version='v1.0.0-rc.2' & stac_object_type=pystac.STACObjectType.ITEMCOLLECTION

code:

import json
import urllib.request  # the lib that handles the url stuff
from pystac.validation import validate_dict
import pystac

data = urllib.request.urlopen('https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/collection.json')
stac_dict = json.loads(data.read().decode())
validate_dict(stac_dict, stac_version='1.0.0-rc.4', stac_object_type=pystac.STACObjectType.ITEMCOLLECTION)

Stack trace:

Traceback (most recent call last):
  File "/Users/sachin/dev/unifi_virtenv3/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3417, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-df8bf7d05ad0>", line 1, in <module>
    runfile('/Users/sachin/dev/next/robotframework/test_stac/py_stac.py', wdir='/Users/sachin/dev/next/robotframework')
  File "/Users/sachin/Library/Application Support/JetBrains/IntelliJIdea2020.2/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "/Users/sachin/Library/Application Support/JetBrains/IntelliJIdea2020.2/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/Users/sachin/dev/next/robotframework/test_stac/py_stac.py", line 13, in <module>
    validate_dict(stac_dict, stac_version='1.0.0-rc.4', stac_object_type=pystac.STACObjectType.ITEMCOLLECTION)
  File "/Users/sachin/dev/unifi_virtenv3/lib/python3.8/site-packages/pystac/validation/__init__.py", line 87, in validate_dict
    return RegisteredValidator.get_validator().validate(stac_dict, stac_object_type, stac_version,
  File "/Users/sachin/dev/unifi_virtenv3/lib/python3.8/site-packages/pystac/validation/stac_validator.py", line 79, in validate
    core_result = self.validate_core(json_dict, stac_object_type, stac_version, href)
  File "/Users/sachin/dev/unifi_virtenv3/lib/python3.8/site-packages/pystac/validation/stac_validator.py", line 167, in validate_core
    schema_uri = self.schema_uri_map.get_core_schema_uri(stac_object_type, stac_version)
  File "/Users/sachin/dev/unifi_virtenv3/lib/python3.8/site-packages/pystac/validation/schema_uri_map.py", line 185, in get_core_schema_uri
    for version_range, range_uri in self.DEFAULT_SCHEMA_MAP['core'][object_type][1]:
TypeError: cannot unpack non-iterable STACVersionRange object

Metadata

Metadata

Assignees

No one assigned

    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