Questions tagged [boost-python]

Library for intuitive and tight integration between C++ and Python.

Boost::python is a C++ library offering seamless integration of C++ and Python with reference handling, built-in and user-defined two-way type conversions, Python/C++ exception translation, function overloading, exposing class hierarchies, docstring support and more.

1337 questions
0
votes
2 answers

working in python console while executing a boost::python module

How can i keep using the console while executing a process from a boost::python module? I figured i have to use threading but I think I'm missing something. import pk #my boost::python module from c++ import threading t =…
Chris S
  • 112
  • 2
  • 10
0
votes
1 answer

Exposing boost::gregorian::date to Python using Boost.Python

I'd like to make boost::gregorian::date available to Python using Boost.Python. But how do I create a decent __str__ function when one is not available on the Boost date class? I'd like to write it like this: BOOST_PYTHON_MODULE(mymodule) { …
Jonas K
  • 4,215
  • 2
  • 24
  • 25
0
votes
1 answer

boost.python Avoid registering inner class twice but still expose in python

I have some C++ data structures where a templated outer struct has an internal struct. Depending on the template parameter the internal structs may or may not be the same type. When I expose the structures to python using boost.python I want to be…
Epimetheus
  • 1,119
  • 1
  • 10
  • 19
0
votes
1 answer

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 single .DLL, which currently contains the program's…
0
votes
1 answer

Error while running bjam in Boost Python

I have installed boostpro (boost 1.47) in my system. (Windows 7 32-bit) when I run bjam command on "C:\Program Files\boost\boost_1_47\libs\python\example" I get the following error C:\Program…
maheshakya
  • 2,198
  • 7
  • 28
  • 43
0
votes
1 answer

Error in building boost:python code

I've the following boost:python code(gona.cpp). #include using namespace std; void say_hello(const char* name) { cout << "Hello " << name << "!\n"; } #include #include using…
maheshakya
  • 2,198
  • 7
  • 28
  • 43
0
votes
2 answers

boost python, using a namespace other than main global

I am embedding python in my C++ application using boost python. I am a C++ programmer, with very limited knowledge of Python. I have a C++ class, PyExpression. Each instance of this class has a string expStr, which is a short user-entered (at…
user773494
  • 37
  • 2
  • 6
0
votes
1 answer

RandomForest.Writehdf5 gives boost.python argument mismatch errror

I am new to python programming. When function Vigra.learning.RandomForest.Writehdf5 is called in the python code, it gives a error as below: self.RF.writeHDF5(fileName, pathInFile, overwriteFlag) Boost.Python.ArgumentError: Python argument types…
user2287258
  • 31
  • 1
  • 3
0
votes
1 answer

strange timing of the python extension execusion or building boost.python with --threading=single

I got very strange behavior of my python extension built with the boost.python library. Namely, in the piece of code: import my_ext j = 0 while j<5: print j my_ext.do_something(j) j = j + 1 i do not see j being printed out, while the…
user938720
  • 271
  • 3
  • 14
0
votes
1 answer

wrapping a string/shared_ptr unordered_map with map_indexing_suite in boost python

I'm trying to wrap a boost::unordered_map using the map_indexing_suite utility in boost python. However, anytime I attempt to do so, I'm encountering the error Error 26 error C2039: 'key_comp' : is not a member of…
Megatron
  • 2,871
  • 4
  • 40
  • 58
0
votes
0 answers

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 (http://code.google.com/p/pyv8/source/checkout) Copying a helloworld.py example into the…
Chris
  • 5,876
  • 3
  • 43
  • 69
0
votes
0 answers

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 int a; void expose_var() { …
Epimetheus
  • 1,119
  • 1
  • 10
  • 19
0
votes
2 answers

A error about converting Python binary to C++ binary in boost.python

I have to convert some binary from Python to C++ by boost::python.The binary maybe come from image or text file.But some error occur for converting the image file's binary into c++.The following is an example. C++ #include…
simon
  • 569
  • 9
  • 20
0
votes
1 answer

Inheritance from python class generated with boost::python

I'm having a problem with inheriting from a python class that I generated using boost::python. I have a class whose function Print() is defined like this: void CMagnet::Print() { cout << "Hello" << endl; } and the interface is defined like this…
zeus300
  • 1,017
  • 2
  • 12
  • 30
0
votes
1 answer

Boost.Python tries to link against python27.lib using Visual C++

I'm trying to build boost python using Python 3.2. I'm linking against python32.lib and libboost_python3-vc110-mt-gd-1_52.lib. I also definied BOOST_ALL_NO_LIB to disable boost's auto link feature. Still I'm getting the following error: fatal error…
jhasse
  • 2,379
  • 1
  • 30
  • 40