Skip to content

Bug: Error when loading collection that was saved in previous python session #43

@ehennestad

Description

@ehennestad

I am trying to load a collection from a single json-ld file created from the example in the README.

If I do this from a new python session, I get the following error:

ValueError                                Traceback (most recent call last)
Cell In [1], line 3
      1 import openminds
      2 fp2 = \"/Users/Eivind/Documents/MATLAB/openMINDS_MATLAB/demo/crew_members.jsonld\"
----> 3 collection2 = openminds.Collection().load(\"my_collection.jsonld\")

File ~/Code/EBRAINS/openMINDS/openMINDS_Python/openminds/collection.py:162, in Collection.load(self, *paths)
    160 if \"@type\" in item:
    161     print(lookup_type)
--> 162     cls = lookup_type(item[\"@type\"])
    163     node = cls.from_jsonld(item)
    164 else:
    165     # allow links to metadata instances outside this collection

File ~/Code/EBRAINS/openMINDS/openMINDS_Python/openminds/registry.py:55, in lookup_type(class_type, version)
     53         return registry[\"types\"][version][class_type]
     54     else:
---> 55         raise ValueError(f\"Type '{class_type}' was not found in the registry for version {version}.\")
     56 else:
     57     raise TypeError(\"class type must be a string\")

ValueError: Type 'https://openminds.ebrains.eu/core/Person' was not found in the registry for version latest."

The registry has not been initialised at this point and does not contain any types.

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