I have a method in python that's implemented like this :
class MyClass:
def __init__(self, i, j, k):
self._i = i
self._j = j
self._k = k
def generate_queue(self, max, min):
# do stuff
return queue_with_ints
class Class2:
def __init__(self, mc):
# mc is a MyClass object
self._mc = mc
the C++ code (I've used list because I didn't find any documentation about a boost::python::queue, and I can always make the python function return a list instead as that wouldn't really make a difference):
class Foo : public Node{
// constructor
// other functions
void do_stuff_with_queue( int max, int min){
// o is an instance of Class2
boost::python::object mc = (this->o).attr("_mc");
boost::python::list q = mc.attr("generate_queue")(max, min);
int length = extract<int>(q.attr("__len__")());
for (int i = 0; i < length; i++){
int subframe = boost::python::extract<int>(q[i]);
// do stuff
}
}
error output:
erreur: conversion from ‘boost::python::detail::dependent<boost::python::api::object, int>::type {aka boost::python::api::object}’ to non-scalar type ‘boost::python::list’ requested
I'm not sure what is happening here, the only other "non scalar type" error I've seen is when someone tried to assign a pointer to an object from this post. How can I fix this?
Thanks