Skip to content

bpy.data.libraries not sortable #4

@drsybren

Description

@drsybren

This code causes a Pylance error:

import bpy

libs = sorted(bpy.data.libraries, key=lambda lib: lib.filepath)

The error:

No overloads for "sorted" match the provided arguments
Pylance reportCallIssue

Argument of type "Unknown | Sequence[Library] | Mapping[str, Library] | bpy_prop_collection" cannot be assigned to parameter "iterable" of type "Iterable[_T@sorted]" in function "sorted"
  Type "Unknown | Sequence[Library] | Mapping[str, Library] | bpy_prop_collection" is not assignable to type "Iterable[_T@sorted]"
    "bpy_prop_collection" is incompatible with protocol "Iterable[_T@sorted]"
      "__iter__" is not present

Pylance: reportArgumentType

The code runs fine, though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions