Skip to content

TypeError: list indices must be integers or slices, not str #400

Open
@dsm-72

Description

@dsm-72
# nbformat.validator.py:360
# Generate cell ids if any are missing
if repair_duplicate_cell_ids:
    cell["id"] = generate_corpus_id()
    changes += 1

Where

# nbformat.corpus.words
"""Generate a corpus id."""
from __future__ import annotations

import uuid


def generate_corpus_id():
    """Generate a corpus id."""
    return uuid.uuid4().hex[:8]

The line:

cell["id"] = generate_corpus_id()

Yields:

TypeError: list indices must be integers or slices, not str

Which will always be a string since uuid.uuid4().hex[:8] is a string.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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