#StackBounty: #c++ #boost #boost-python How to create a numpy array of boost::python::object types

Bounty: 200

I’m trying to create a 2×2 numpy array of python objects:

#include <boost/python.hpp>
#include <boost/python/numpy.hpp>
int main()
    boost::python::tuple shape = boost::python::make_tuple(2, 2);
    boost::python::object obj;
    boost::python::numpy::dtype dt = boost::python::numpy::dtype(obj);
    boost::python::numpy::ndarray array = boost::python::numpy::empty(shape, dt);
    std::cout << "Datatype is: " << boost::python::extract<char const *> boost::python::str(array.get_dtype())) << std::endl;

But the output is "Datatype is: float64" rather than a python object type.

What am I doing wrong?

I suspect I’m misusing the dtype constructor.

Get this bounty!!!

#StackBounty: #python #python-3.7 #boost-python user-config.jam not being interpreted correctly on windows 10

Bounty: 50

I am trying to build the python bindings of libtorrent using boost version 1.63. I’ve set up my user-config.jam file in my home directory like so:

using python : 3.7 : C:/Program Files (x86)/Python/Python37-32/python.exe : C:/Program Files (x86)/Python/Python37-32/Include : C:/Program Files (x86)/Python/Python37-32/libs ;

However when I am running

bjam libtorrent-link=static boost-link=static stage_module

inside the directory of the python bindings of libtorrent I get the following error:

*** argument error
* rule python.init ( version ? : cmd-or-prefix ? : includes * : libraries ? : condition * : extension-suffix ? )
* called with: ( 3.7 : C:/Program Files (x86)/Python/Python37-32/python.exe : C:/Program Files (x86)/Python/Python37-32/Include : C:/Program Files (x86)/Python/Python37-32/libs :  :  :  :  )
* extra argument Files

I’ve done this before on Windows 7 but I haven’t experienced anything like that. I’ve tried all possible ways of formatting it like escaping spaces and parenthesis with a caret ^, using quotes ' or double quotes ". I’ve also tried using both forward slash and backslash. Everything yields the same error except for the double quotes:

'C:/Program' is not recognized as an internal or external command,
operable program or batch file.

Can anyone point out what I am doing wrong?

Get this bounty!!!