Skip to content

Containers (eg Seq) not iterable? #3133

Open
@jbonevich

Description

@jbonevich

When I try the following code, I get a KeyError: 0

from rdflib import Graph, Namespace, Seq, Literal, BNode

graph = Graph()
ns = Namespace("http://example.org#")

b = BNode()
seq = Seq(graph, uri=b, seq=[Literal('Elt1'), Literal('Elt2'), Literal('Elt3')])

for item in seq:
    print(item)

Traceback (most recent call last):
File ".../rdfcollections.py", line 9, in
for item in seq:
File ".../python3.11/site-packages/rdflib/container.py", line 108, in getitem
raise KeyError(key)
KeyError: 0

Using rdflib version 7.1.4 and python 3.11.0

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