Closed nyckmaia closed 2 years ago
You have a type which is not known to pybind, therefore it renders as C++. Please follow the link from the message (https://pybind11.readthedocs.io/en/latest/advanced/misc.html#avoiding-cpp-types-in-docstrings) for more details.
@sizmailov this warning message is related to my use of const std::initializer_list<std::string>&
in this constructor overload below?
py::class_<Score> cls(m, "Score");
cls.def(py::init<const std::initializer_list<std::string>&, const int>(),
py::arg("partsName"),
py::arg("numMeasures") = 20,
py::call_guard<py::scoped_ostream_redirect, py::scoped_estream_redirect>());
This is not a custom type. So, I don't know how to solve it.
Could you help me?
Thank you
Yes, the problem is with std::initializer_list<std::string>
constructor overload as you can see from the error message, note the ^-- Invalid syntax
part:
[2022-08-18 20:57:31,607] {__init__.py:135} WARNING - def __init__(self: maialib.maiacore.Score, partsName: std::initializer_list<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, numMeasures: int = 20) -> None: ...
[2022-08-18 20:57:31,607] {__init__.py:136} WARNING - ^-- Invalid syntax
The problem is that pybind module needs to know bindings of the type. It doesn't matter whether a C++ type comes from the STL or not. Pybind provides bindings for some classes from STL, but if you need some beyond that you must provide bindings by yourself.
Hi, I got a perfect running stubs generation using
pybind11-stubgen
. It works great.Question
Now, I just would like to remove this warning below. Could you help me?
Here the same message in a print screen
Here is my
Score
class bind codeHere the same code in a print screen (with colors):
Thank you