Tagged Questions
5
votes
1answer
283 views
Setting metaclass of wrapped class with Boost.Python
I have an Event class defined in C++ that I expose to Python using Boost. My scripts are expected to derive from this class, and I'd like to do some initialization whenever a new child class is ...
3
votes
1answer
118 views
Extending an embedded python interpreter with global instance of a c++ object
I have a class
class A {
A(SomeClass* ptr);
do_something();
};
Which I want to use in an embedded python interpreter using boost-python
I have gotten so far that I have managed to create an ...
3
votes
1answer
177 views
Building Python libraries on a Mac and experiencing flat namespace errors
As a general rule, I rue the days whenever I have to build Python libraries on a Mac. I've generally had fairly good success using Boost::Python, and if I use distutils, most of the time everything ...
2
votes
1answer
102 views
Strange TypeError occured when calling method function exposed by boost python
I write a python wrapper for box2d, everything work perfect but a strange TypeError error occurs sometimes when calling method function exposed by boost python. It's a random behavior, not happened ...
2
votes
1answer
278 views
Passing C++ objects to python with boost
I'm trying to figure out how to use boost python to create an object in c++ and pass it into Python. I've managed to do this but then can't get garbage collection to occur.
Imagine the class A is ...
2
votes
1answer
217 views
How to speed up Boost::Python::Extract when passing a list from python to a C++ vector
I'm new to boost.python and have made a simple function for passing a list from python to a C++ vector:
void SetXValues(boost::python::list xl){
int n = len((xl));
xvals.resize(n);
...
2
votes
1answer
534 views
Python wrapper for UDT C++ library
I want to use the UDT library in Python, so I need a wrapper. I found this one: pyudt, but I dont know exactly how to use this to send files from a peer to peer. Can anybody point me in the right ...
1
vote
1answer
186 views
Boost Python Hello World example not working in Python, AGAIN
I have the same problem than the guy here
Boost Python Hello World example not working in Python
who solved his problem, without indicating how. The posts there being quite old, after having posted ...
1
vote
1answer
162 views
Can't compile python bindings using boost-python on OS X
I try to do python bindings on C++ using boost-python, but I can't compile and I can't find out why.
I'm using a code sample from boost-python hello.cpp:
// Copyright Ralf W. Grosse-Kunstleve ...
1
vote
1answer
119 views
Exposing a C++ singleton in Python
I'm trying to wrap a C++ singleton with boost::python:
class EigenSolver {
private:
static EigenSolver* _self;
static int _refCount;
protected:
EigenSolver();
...
1
vote
1answer
218 views
Pass boost::python::object by value or const reference?
Should I be passing boost::python::object objects to C++ functions by value or by const reference? I almost always pass around non-trivial objects in C++ via const reference. However, in the Boost ...
1
vote
1answer
518 views
Boost::Python: How do I expose a dynamic non-object array to a PyBuf?
I'm working on a Computer Vision system with OpenCV in C++. I wrote a small GUI for it by using Boost::Python and PyQT4. Since I don't want to introduce QT to the C++ project, I need a way to expose ...
1
vote
1answer
321 views
Boost Python wrapper for a c++ class that uses Opencv 2.3
I am trying to create a python library from a class which uses opencv 2.3. I want to be able to pass numpy array's into the class where they will be converted into cv::Mat's processed then converted ...
1
vote
1answer
457 views
Boost python wrapping a virtual method
I'm using boost python to create a binding to a c++ library. A number of classes in this library have virtual methods which accept iterator/const_iterator types as arguments. I don't particularly want ...
1
vote
1answer
341 views
Linking error Boost.Python with stlport as stdlib
I'm trying to create C++ extensions for python. My C++ code relies on STLPort 5.1.0. I've compiled boost.python with stdlib=stlport. This occurs in my compiler which is Microsoft Visual Studio ...
1
vote
1answer
167 views
Reinterpret a CGImageRef using PyObjC in Python
I'm doing something that's a little complicated to sum up in the title, so please bear with me.
I'm writing a Python module that provides an interface to my C++ library, which provides some ...
1
vote
1answer
581 views
Using boost.python to import a method with opencv calls but failing due to symbols not being found after compilation
So I don't have the code right now, as I am not home... but i used the boost library for python in C++ to allow python to access a function called something like loadImageIntoMainWindow(string ...
1
vote
1answer
448 views
Problem installing Shoutpy + Boost.python on opensolaris
Im trying to install shoutpy on opensolaris 2009.6. It relies on boost.python. i've installed the boost_devel libraries from blastwave and linked /opt/csw/include/boost to /usr/include/boost . But ...
0
votes
1answer
42 views
Embedding Python 3.3 in a C++ program while only able to read one line at a time from input
I am currently working on adding embedded Python support (and yes, extending is not an option) to a large program as part of my summer internship. Ideally, I can keep the Python support within a ...
0
votes
1answer
27 views
Error in building boost:python code
I've the following boost:python code(gona.cpp).
#include <iostream>
using namespace std;
void say_hello(const char* name) {
cout << "Hello " << name << "!\n";
}
...
0
votes
1answer
287 views
Boost Python hello example gives errors .
I have been trying to get Boost.Python running . I am following the steps mentioned here
http://www.boost.org/doc/libs/1_50_0/libs/python/doc/tutorial/doc/html/python/hello.html
. However when i try ...
3
votes
0answers
130 views
Optimising boost::python::object instances
I recently started using Boost's Python library to wrap parts of a rather large C++ library.
Quite by chance, I discovered that every Python object created by Boost Python, is at least bigger than ...
1
vote
0answers
37 views
How to expose raw byte buffers with Boost::Python?
I've got third party C++ library in which some class methods use raw byte buffers. I'm not quite sure how to deal in Boost::Python with it.
C++ library header is something like:
class CSomeClass
{
...
1
vote
0answers
199 views
Error compiling Boost.Python quickstart
I've been trying to compile the Boost.Python 'quickstart' ($BOOST_PATH\libs\python\examples\quickstart) examples and have run into an issue.
First, my environment:
OS: Windows 7 Ultimate 64 bit
...
1
vote
0answers
113 views
Linking Boost-Python Hello World
I am trying to compile and link boost-python hello world example and I have some linking problems.
OS: Ubuntu
g++ -fPIC -w Test2.cpp -I ../../../Libs/Python/Python-2.7.3/Include -I ...
1
vote
0answers
147 views
boost.python: calling member function of c++ instance from embedded interpretter
I'm trying to add Python scripting capabilities to my application using boost.python. What I would like to do is to use Python to evaluate simple expressions, on specific C++ class instances, ...
1
vote
0answers
78 views
Boost.Python: Registering Non-Boost.Python Converters
I have a project that uses Boost.Python and SFML. Many of my objects expose SFML types and, in the interest of not reproducing the wheel, I would like to return objects from my own bindings that are ...
1
vote
0answers
167 views
unexpected result iterating over a boost::python vector_indexing_suite
I have wrapped successfully a class named Composite.
This class has the following method:
std::vector<Composite*> Composite::getChildren();
I tried to wrap the returned std::vector using the ...
1
vote
0answers
179 views
Passing C++ double arrays (pointer to pointer) to Python script
I'm trying to pass a C++ class with some 2D array member variables to a Python script. The 2D arrays are allocated directly into the class, independent of the constructor. I am using the boost_python ...
1
vote
0answers
208 views
Wrapping Static C++ arrays for Python
I'm in the process of trying to wrap a few C++ header files that have classes that use pointers in two of the following ways:
1) As arrays as data members for a class.
2) As an array as an argument ...
1
vote
0answers
249 views
Boost.Python method returned strings truncated, unexpected integer values
I'm using Boost.Python to expose JRA's BWRepLib so I can try to do some data mining on sc:bw replays in python and I've run into a small problem with the values being returned from the C++ methods. ...
0
votes
0answers
65 views
Shared pointer to a vector..in boost::python?
I'm trying to expose a class with a method that takes a boost::shared_ptr< std::vector < MyClass > > using boost::python, and I'm not entirely sure how to do so...
The ideal interface ...
0
votes
0answers
54 views
Boost loads all registered exception with every method/function call
I saw in my call stack that Boost translates ALL my registered(register_exception_translator) exceptions always before executing class method. Every time!
That is madness and not good for ...
0
votes
0answers
56 views
Building PyV8 (a C++/Python project) from source in Windows
How do you get started running (and debugging) a C++/Python combined project?
So far I've started with the basics:
Checking out the project from source ...
0
votes
0answers
83 views
Expose C++ dynamically in boost.python
I'm wondering if boost.python allows C++ functionality to be exposed to python after the module has loaded. For example it would be nice if something like this might work:
#include ...
0
votes
0answers
133 views
boost::python::exec_file not closing file descriptor with python 2.7
I am trying to execute a python script in my c++ code using python2.7 and boost1.47.0
Here is the code:
#include "boost/python.hpp"
#include <iostream>
int main(int argc, char** argv)
{
...
0
votes
0answers
52 views
Pass Python Class as argument to Boost-Python wrapped function
I have an extension module written with boost, and would like to allow the writers of other extension modules to register some elements of their module with my own like so:
...
0
votes
0answers
95 views
Boost Python quickstart examples give error
when i try running the example under C:\boost_1_50_0\libs\python\example\quickstart i get the following error and my python file gets removed ( which is quite annoying ) . I am using Python 3.3 & ...
0
votes
0answers
71 views
Exposing classes with boost:python, stuck at the beginning
I am trying to get into boost:python to be able to expose C++ functions in my program and having some sort of "user interface" through python.
However, I already found myself stuck on the first ...
0
votes
0answers
66 views
Using class virtual functions with Boost.Python in C++
I'm looking to use Boost.Python to satisfy the use case described below.
I have a C++ request/response server that handles requests based on a request type that is defined by the protocol and ...
0
votes
0answers
137 views
cross-platform setup.py using boost::python
I would like to upload a small setup.py-based (distutils) module to pypi, so that it is easy_install'able (also under windows). The module is a single compiled extension compiled from several files. ...
0
votes
0answers
58 views
Wrapping overloaded C++ functions returning a reference
I need to wrap several overloaded C++ functions like
static SparseMatrix &create(const OptionsSet &opts,
const KERNEL::Elements<KERNEL::BasicTypes_CPU>* elem,
const ...
0
votes
0answers
118 views
D-Bus connection error
I'm making a Bluetooth app which receives data from Health oximeter.
I modified the code of L84-102 in the below script to function, and call it
from C++ program using boost.python
My program flow ...
0
votes
0answers
46 views
python module stuck
I have made a python module (with boost::python), which at some point creates an array (2D vector) of some massive objects. The total size of the objects is something like a few Gb. When starting ...
0
votes
0answers
120 views
Extend c++ API with boost::python
I have an API in c++ which communicates with a 3rd party program via socket. Because my whole project is in python, I am trying to wrap the API using boost::python. I can expose the classes, methods ...
0
votes
0answers
74 views
I am unable to build boost.python with gcc 3.3.5 and python2.4 : compilation error
In file included from boost/unordered/detail/emplace_args.hpp:16,
from boost/unordered/detail/allocator_helpers.hpp:18, from
boost/unordered/unordered_set.hpp:17, from boost/unordered_set.hpp:16,
...
0
votes
0answers
164 views
boost python - how to send a raw pointer to a python function>
I have python embedded in my application and I want to send a python function a raw pointer to an object I have in my C++ code.
The only way I found how to do this is to wrap the pointer with an ...
0
votes
0answers
166 views
Printing Output in an Embedded Boost::Python terminal
I'm building a C++ program with Qt, boost::python and PyQt which has an embedded Python terminal. Everything works great. We've got the C++ exposed, we can run things, pass data back and forth, etc. ...
0
votes
0answers
48 views
What's the best way to manipulate Boost INFO file in Python
I have a C++ program which read a Boost INFO file as a configuration file, and now I'm planning to dev a python script to manipulate those conf files. What's the best way to do it?
I can't find any ...
0
votes
0answers
245 views
Boost Python Extension which uses OpenCV
I'm building a C++ Python extension using Boost. The project includes the OpenCV1.1 library which is pre-built. All libraries built by the OpenCV make are in the /usr/lib directory. Here is my Jamroot ...