Skip to content

[Python] Builder object has no attribute CreateVectorOfTables #8940

@RCRalph

Description

@RCRalph

Greetings,

I'm having issues with using code generated for the Python language.
Specifically, if I use a nested table in my schema, the following code is generated:

def MyTableCreateValuesVector(builder: flatbuffers.Builder, data: Iterable[Any]) -> int:
    return builder.CreateVectorOfTables(data)

Unfortunately, when I try to use this method, I get the following error:

'Builder' object has no attribute 'CreateVectorOfTables'

I'm using FlatBuffers version 25.12.19

> flatc --version
flatc version 25.12.19
> uv pip show flatbuffers
Name: flatbuffers
Version: 25.12.19
Location: [CWD]/.venv/lib/python3.13/site-packages
Requires:
Required-by: [my-package]

Code generation

You can reproduce the issue with the following schema:

namespace Example;

table NestedTable {
  value:uint64;
}

table MyTable {
  values:[NestedTable];
}

root_type MyTable;

I used the following command to generate the code:

flatc --python --python-typing example.fbs

Example script which replicates the issue:

import flatbuffers

import Example.NestedTable
import Example.MyTable

builder = flatbuffers.Builder()

Example.NestedTable.NestedTableStart(builder)
Example.NestedTable.NestedTableAddValue(builder, 10)
nested_table = Example.NestedTable.NestedTableEnd(builder)

nested_table_vector = Example.MyTable.MyTableCreateValuesVector(builder, [nested_table])  # <--- Fails here

Example.MyTable.MyTableStart(builder)
Example.MyTable.MyTableAddValues(builder, nested_table_vector)
my_table = Example.MyTable.MyTableEnd(builder)

builder.Finish(my_table)

Observations

From what I've seen in the repository, it seems like this method is present and all is well.
Unfortunately, when I download the package from PyPI, this method doesn't exist.

Could you please check if you are publishing the correct version of the package?
I looked into recent releases and it seems like this method is missing in all of them.

Manually replacing the builder.py file's content with what exists in the repository fixes the issue.

Thanks :3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions