Hello, I followed the "official" tutorial and others but still don't manage to expose this pure virtual method (getPeptide) :
ms_mascotresults.hpp
class ms_mascotresults {
public:
ms_mascotresults(ms_mascotresfile &resfile,
const unsigned int flags,
double ...
Hello, I'm a newbie with Boost::Python but I tried to search on the web to do so
I want to expose a 3rd party library to Python. One of the class of the library (.hpp) is composed of
a public constructor with arguments
a protected constructor and functions
various regular functions
various pure virtual functions
various non pure virt...
I have a C++ function that is being called from many Python functions via Boost::Python. When the C++ function detects bad arguments I want to write a log message and continue processing. In that log message I would like to note the Python module and line number that called into C++. How can I do this?
I am able to throw an exception fr...
I have a C++ class, which has the following methods:
class Bar {
...
const Foo& getFoo() const;
void setFoo(const Foo&);
};
where class Foo is convertible to std::string (it has an implicit constructor from std::string and an std::string cast operator).
I define a Boost.Python wrapper class, which, among other things, defines...
Trying to build the following simple example
#include <boost/python.hpp>
using namespace boost::python;
tuple head_and_tail(object sequence)
{
return make_tuple(sequence[0],sequence[-1]);
}
available here, I end up with this compilation error under Visual Studio 9
error C2668: 'boost::python::make_tuple' : ambiguous call to over...
You can add a property to a class using a getter and a setter (in a simplistic case):
class<X>("X")
.add_property("foo", &X::get_foo, &X::set_foo);
So then you can use it from python like this:
>>> x = mymodule.X()
>>> x.foo = 'aaa'
>>> x.foo
'aaa'
But how to add a property to a module itself (not a class)?
There is
scope().a...
I'm having some trouble seeing what the best way to wrap a series of classes with Boost.Python while avoiding messy inheritance problems. Say I have the classes A, B, and C with the following structure:
struct A {
virtual void foo();
virtual void bar();
virtual void baz();
};
struct B : public A {
virtual void quux();
}...
Hi, 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 specialized image manipulation functionality. It would be most convenient to be able to access image buffers as CGImageRefs from Python, so they...
Python interpreter has a Global Interpreter Lock, and it is my understanding that extensions must acquire it in a multi-threaded environment. But Boost.Python HOWTO page says the extension function must release the GIL and reacquire it on exit.
I want to resist temptation to guess here, so I would like to know what should be GIL locking...
I have started to play around with boost python a bit and ran into a problem. I tried to expose a C++ class to python which posed no problems. But I can't seem to manage to implement the __str__ functionality for the class without getting build errors I don't understand.
I'm using boost 1_42 prebuild by boostpro. I build the library usi...
I downloaded the latest version of Boost and I'm trying to get the Boost.python tutorial up and running on Ubuntu 10.04: http://www.boost.org/doc/libs/1_43_0/libs/python/doc/tutorial/doc/html/python/hello.html
I navigated to the correct directory, ran "bjam" and it compiled using default settings. I did not yet create a bjam config file...
I have wondered about this on and off but I never really got a definite answer. Is it possible within the boost.python framework to link against another boost.python module.
For example I have exported class A within boost_python_module(libA) and function B(A a) within boost_python_module(libB). Is it possible to specify in libB to lin...
Hello all,
I recently installed Boost using MacPorts, with the intent to do some Python embedding in C++. I then decided to check if I configured Xcode correctly with an example found on Python's website:
#include <boost/python.hpp>
using namespace boost::python;
int main( int argc, char ** argv )
{
try
{
Py_Initial...
I am attempting to install PyV8 (http://code.google.com/p/pyv8/) using:
python setup.py install
However, the build fails with the following:
louis@louis-desktop:~/Downloads/PyV8-0.9$ python setup.py install
running install
running build
running build_py
running build_ext
building '_PyV8' extension
gcc -pthread -fno-strict-aliasing -D...
I'm using Boost.Python to wrap a C++ library.
How do I ensure that the same Python instance (by object identity) is always returned for a particular C++ instance (by pointer identity)? I can't extend the C++ classes, but I can add a member variable (such as a PyObject * or a boost::python::handle<>) if that helps. I'm thinking that I sh...
Me and a friend are developing an application which uses Boost::Python. I have defined an interface in C++ (well a pure virtual class), exposed through Boost::Python to the users, who have to inherit from it and create a class, which the application takes and uses for some callback mechanism.
Everything that far goes pretty well. Now, t...
Is it possible to pickle (using cPickle) an enum that has been exposed with Boost.Python? I have successfully pickled other objects using the first method described here, but none of that seems to apply for an enum type, and the objects don't seem to be pickleable by default.
...
I am new to python, I have looked at boost python, and it looks very
impressive. However going through the introduction I can not find
any examples where, vector of objects are returned as python list/tuples.
i.e Take this example, I want to expose class X, Cont and all its functions.
critical bit being return a vector of X's or st...
I have a library which creates objects (instances of class A) and pass them to a python program which should be able to call their methods.
Basically I have C++ class instances and I want to use them from python. Occasionally that object should be passed back to C++ for some manipulations.
I created the following wrapper file (let's as...
Hi folks,
I've been trying to figure out how to wrap the following C functions = compress.c , compress.h.
I tried following the tutorials, but after creating the .pxd file I don't know what to do :|
From what I have understood this is the pxd file that I should have
cdef extern from "compress.h":
size_t compress(void *s_start, v...