Re: [C++-sig] Building tutorial example out of the boost tree, on Windows

2013-10-09 Thread John Reid
On 07/10/13 16:21, Gary Oberbrunner wrote: > > > - Original Message - >> From: "John Reid" > ... >> Have you tried pointing the use-project boost to the boost source >> directory rather than the boost installation directory? I don't think

Re: [C++-sig] Building tutorial example out of the boost tree, on Windows

2013-10-07 Thread John Reid
On 04/10/13 19:12, Gary Oberbrunner wrote: > Hi folks -- new to Boost.Python, old-school C/C++/Python developer. > > I'm trying to set up Boost.Python 1.54.0 on Windows 7, python 2.7.3, Visual > Studio 2010. I installed boost_1_54_0 using the VS10 installer, then built > bjam using 'bootstrap; .

[C++-sig] Use alternative launcher for bpl-test rule

2013-09-24 Thread John Reid
Hi, I'm having some problems asking boost.build to start the debugger or valgrind when it runs some of my python extension bpl-test rules. I saw in the boost.build code some comments that suggests it hijacks the testing.launcher feature which I thought would be the way to do this. Does anyone know

[C++-sig] Inner class name

2013-06-04 Thread John Reid
Inner classes seem to be given the wrong name or perhaps this is by design. Could someone enlighten me? If I do: namespace py = boost::python; py::class_< T > outer( "Outer" ); py::scope( outer ); py::class_< U > inner( "Inner" ); then in python: import module as M print M.Outer.Inner gives "M.

[C++-sig] using debug python with boost build

2012-09-18 Thread John Reid
Hi, I'm setting up my environment on a fresh machine with boost 1.51 and I can't get my python debug builds to work. I've got this in my user-config.jam using python ; using python : : /home/john/local/Python-2.7.3-dbg/bin/python : : : on ; I've built a python debug and installed it into /home

Re: [C++-sig] Accessing 2D array from python in C++

2012-08-22 Thread John Reid
Python. Actually, my problem is the other way around in which I have > a Python array that needs to be converted to/ exposed in C++. Exposing works both ways. > > Thanks in advance. > > > ---- > *From:*

Re: [C++-sig] Accessing 2D array from python in C++

2012-08-22 Thread John Reid
On 22/08/12 11:58, John Reid wrote: > > > On 22/08/12 11:45, alfa wrote: >> Hi John, >> >> I'm sorry, I'm a bit confused because previously you said that the >> relevant implementation resides in >> "c++/myrrh/myrrh/python/multi

Re: [C++-sig] Accessing 2D array from python in C++

2012-08-22 Thread John Reid
multiarrays of doubles to python as numpy arrays. Please ask if you have any specific questions. Regards, John. > > > ---- > *From:* John Reid > *To:* cplusplus-sig@python.org > *Sent:* Wednesday, August 22,

Re: [C++-sig] Accessing 2D array from python in C++

2012-08-22 Thread John Reid
dvance. > src/python/man_module.cpp and src/python/multi_array_to_numpy.cpp implement a boost.python module that exposes the multi-array classes. You have choose which data types you expose multiarrays for. HTH, John. > > -----

Re: [C++-sig] Accessing 2D array from python in C++

2012-08-16 Thread John Reid
If you don't mind digging around in my code, you could download the source code for the STEME python package from pypi and look in the c++/myrrh directory. There is code to access multi_arrays from python in there. http://pypi.python.org/pypi/STEME/ In particular the file c++/myrrh/myrrh/python/m

Re: [C++-sig] Interact python with C++

2012-08-14 Thread John Reid
On 14/08/12 00:05, Murat Atalay wrote: > Hello Everyone, > > Currently, I am trying to call C++ classes and functions from python > inside my C++ program. I want to be able to edit the members and call > functions from python. I am using VS2010 with boost libraries. Boost > comes with very big em

Re: [C++-sig] Indexing suite v2 multiple module problem

2012-07-25 Thread John Reid
On 25/07/12 09:44, Roman Yakovenko wrote: > Do you use dlopen? > > import sys > sys.setdlopenflags(RTLD_NOW | RTLD_GLOBAL) > > In multi-module environment you have to share boost python registry. (Sorry if this is a duplicate post, the last one seemed to disappear) Thanks, your advice fixed it:

[C++-sig] Indexing suite v2 multiple module problem

2012-07-25 Thread John Reid
Hi, I'm using a version of the indexing suite I believe I copied from Roman's codebase some time ago. I've recently refactored my project into multiple modules and now I'm have some runtime errors when iterating over sequences in python. At runtime I get the cryptic message: RuntimeError: get It

Re: [C++-sig] Instance ownership transfer in constructor.

2012-07-05 Thread John Reid
On 05/07/12 11:49, Jani Tiainen wrote: > Hi, > > I'm new to python.boost library and I'm trying to use it to wrap a third > party library. Everything else I've managed to get working - thanks to > excellent library and lot of examples I've found around a net. > > Only thing I can't get working pr

[C++-sig] ANN: pyicl, a python interval container package based on boost.icl

2012-05-21 Thread John Reid
pyicl is a python package that exposes the functionality of boost.icl to python using boost.python. Documentation: http://packages.python.org/PyICL/ PyPi page: http://pypi.python.org/pypi/PyICL/ boost.icl is a general purpose interval container library written in C++. Its author, Joachim Faulhabe

Re: [C++-sig] Define class in 2 scopes without re-exposing

2012-04-16 Thread John Reid
On 16/04/12 19:13, Dave Abrahams wrote: > > on Mon Apr 16 2012, John Reid wrote: > >> On 15/04/12 03:23, Dave Abrahams wrote: >>> >>> You can't do this; don't even try. Each C++ class has to have a unique >>> Python identity. If you jus

Re: [C++-sig] Define class in 2 scopes without re-exposing

2012-04-16 Thread John Reid
On 15/04/12 03:23, Dave Abrahams wrote: You can't do this; don't even try. Each C++ class has to have a unique Python identity. If you just want to refer to the same class by a different name, you can of course: BOOST_PYTHON_MODULE( _sandbox ) { namespace bp = ::boost::python; obj

[C++-sig] Define class in 2 scopes without re-exposing

2012-04-13 Thread John Reid
Hi, If I want to define the same class (Inner) in 2 different scopes (Outer1 and Outer 2), I can do it like this: #include struct Outer1 {}; struct Outer2 {}; struct Inner {}; BOOST_PYTHON_MODULE( _sandbox ) { namespace bp = ::boost::python; { bp::scope scope = bp::class_< O

[C++-sig] automatic conversion from python unicode object to C++ std::string?

2011-08-12 Thread John Reid
I recently upgraded to ipython 0.11. In 0.11 sys.argv entries are of type unicode rather than string. All of my scripts that call into boost.python extensions fail as my exposed functions expect arguments of type std::string. Presumably I could recode all my functions to use std::wstring and ev

Re: [C++-sig] GSoC 2011 proposal for improved NumPy wrapper ?

2011-03-25 Thread John Reid
On 24/03/11 20:14, Jim Bosch wrote: If we start with boost/python/numpy, I think the most important tasks are: - Add "object manager" classes for additional numpy types ("object managers" are Boost.Python versions of Python types; right now boost/python/numpy only supports the most important nump

Re: [C++-sig] 2 "using python" declarations in user-config.jam not working

2010-11-05 Thread John Reid
On 05/11/10 14:42, John Reid wrote: Hi, I can't get boost.build configured for 2 different python versions, of which one is a debug build. I follow the instructions here: http://www.boost.org/doc/libs/1_44_0/libs/python/doc/building.html My user-config.jam has entries like this # de

[C++-sig] 2 "using python" declarations in user-config.jam not working

2010-11-05 Thread John Reid
Hi, I can't get boost.build configured for 2 different python versions, of which one is a debug build. I follow the instructions here: http://www.boost.org/doc/libs/1_44_0/libs/python/doc/building.html My user-config.jam has entries like this # default python - this picks up a standard Ubuntu

Re: [C++-sig] boost.python and distutils

2010-10-27 Thread John Reid
On 26/10/10 15:12, Andreas Kloeckner wrote: Hi John, I've done distutils+Boost.Python for years now, without any issue. See here for code examples: - http://git.tiker.net/pyopencl.git - http://git.tiker.net/pyublas.git - http://git.tiker.net/pycuda.git Also the instructions in README_SETUP.txt

Re: [C++-sig] boost.python and distutils

2010-10-27 Thread John Reid
Hi Andreas, On 26/10/10 15:12, Andreas Kloeckner wrote: Hi John, I've done distutils+Boost.Python for years now, without any issue. See here for code examples: - http://git.tiker.net/pyopencl.git - http://git.tiker.net/pyublas.git - http://git.tiker.net/pycuda.git After following the gettin

[C++-sig] boost.python and distutils

2010-10-26 Thread John Reid
Hi, I need to distribute a python package that includes a boost.python extension. I've been working on Linux but I'd like the distribution to install easily on any platform with boost and python. I'm guessing distutils is the way to go. I'm not sure if the easiest way is to try to get distut

Re: [C++-sig] Pickle python subclass of C++ interface

2010-07-20 Thread John Reid
Hans Meine wrote: On Sunday 18 July 2010 11:16:29 John Reid wrote: I'm not sure what you mean by mix-in, but my first attempt involved defining pickle suite getstate() and setstate() methods. I did not define a getinitargs() method. Unfortunately when the derived object was unpickled, __i

Re: [C++-sig] Pickle python subclass of C++ interface

2010-07-19 Thread John Reid
John Reid wrote: John Reid wrote: John Reid wrote: Ralf W. Grosse-Kunstleve wrote: Ok I'll give that a whirl. I was hoping to avoid doing __getinitargs__() for each subclass as I have quite a few of them. If I didn't have a C++ base class then the pickling would just work as i

Re: [C++-sig] Pickle python subclass of C++ interface

2010-07-19 Thread John Reid
John Reid wrote: John Reid wrote: Ralf W. Grosse-Kunstleve wrote: Ok I'll give that a whirl. I was hoping to avoid doing __getinitargs__() for each subclass as I have quite a few of them. If I didn't have a C++ base class then the pickling would just work as is. There's n

Re: [C++-sig] Pickle python subclass of C++ interface

2010-07-18 Thread John Reid
John Reid wrote: Ralf W. Grosse-Kunstleve wrote: Ok I'll give that a whirl. I was hoping to avoid doing __getinitargs__() for each subclass as I have quite a few of them. If I didn't have a C++ base class then the pickling would just work as is. There's no way I can get back

Re: [C++-sig] Pickle python subclass of C++ interface

2010-07-18 Thread John Reid
Ralf W. Grosse-Kunstleve wrote: Ok I'll give that a whirl. I was hoping to avoid doing __getinitargs__() for each subclass as I have quite a few of them. If I didn't have a C++ base class then the pickling would just work as is. There's no way I can get back to that sort of situation with the C

Re: [C++-sig] Pickle python subclass of C++ interface

2010-07-17 Thread John Reid
;s no way I can get back to that sort of situation with the C++ base class is there? Thanks, John. - Original Message ---- From: John Reid To: cplusplus-sig@python.org Sent: Sat, July 17, 2010 2:17:12 AM Subject: [C++-sig] Pickle python subclass of C++ interface Hi, I'm usin

[C++-sig] Pickle python subclass of C++ interface

2010-07-17 Thread John Reid
Hi, I'm using boost.python. I want to pickle some python subclasses of a C++ base. The C++ base does not have any state, it is just an interface. Is there an easy way to ask the python pickling machinery to ignore the C++ base? I'm not sure if I should use the boost.python pickling support or

Re: [C++-sig] Problem with map_indexing_suite

2010-07-12 Thread John Reid
Damien Dupuis wrote: I'm trying to wrap a whole C++ that contains a lot of access to std::vector and std::map. I managed to wrap vectors but i've got problems with maps. The following simple example fails to compile with the error: error: no match for call to ‘(const boost::python::detail::

Re: [C++-sig] Problem with map_indexing_suite

2010-07-12 Thread John Reid
Pentix wrote: Hi, Damien! I've got exactly the same problem... Have you got any achievements? Have a look at: http://www.boost.org/doc/libs/1_43_0/libs/python/doc/tutorial/doc/html/python/functions.html#python.call_policies Damien Dupuis wrote: error: no match for call to ‘(const boost::

Re: [C++-sig] Generating API documentation when using boost::python

2010-04-16 Thread John Reid
James Amundson wrote: On 04/15/2010 03:53 AM, Murray Cumming wrote: (If anyone can suggest a better alternative to nasty pydoc, I'd be glad.) I always thought it should be possible make boost.python configurable so the user can choose which docstring format is output (standard, epytext mar

Re: [C++-sig] profiling python extension

2010-03-01 Thread John Reid
Alexey Akimov wrote: Thank you John, I just installed the tool you suggested and tried to use it. However I do not see any output. Could you give some more detailes of how the profiling process with the google-profiler should look like? What I do is: 1) bjam variant=profile toolset=gcc cxxfl

Re: [C++-sig] profiling python extension

2010-02-28 Thread John Reid
Alexey Akimov wrote: Does anyone know how one may profile a python extention? I've used the google profiler on Linux successfully in the past. It is quite straightforward to set up inside an extension. http://goog-perftools.sourceforge.net/doc/cpu_profiler.html John. __

Re: [C++-sig] how do i interrupt a C++ extension?

2010-02-06 Thread John Reid
Amos Anderson wrote: Thanks for the responses! It sounds like there's just no way to send a signal to C++. Moving loops from C++ to Python around is not really a solution for us because we need to be moving them in the other direction if they're to be moved at all. This is molecular simulation

[C++-sig] boost::multi_array numpy conversion

2009-06-06 Thread John Reid
I've developed some boost::python code that allows conversion from numpy arrays to boost::multi_array_refs and from boost::multi_array(ref)s to numpy arrays without copying data. It does not deal with lifetime management but nevertheless I've found it very useful. I know pyublas performs a simi

[C++-sig] Python exception traceback infomation in C++

2009-04-04 Thread John Reid
I call my C++ extension from python and the C++ code in turn calls back into python code. When the python callbacks raise exceptions I can't easily find out the tracebacks, they stop short at the C++ interface. I might put decorators on all my python callbacks to log the tracebacks. Is there an

Re: [C++-sig] Call Policy for Singleton

2009-02-13 Thread John Reid
ZaeX wrote: And in my opinion, you'd better be careful if you expect that the c++ code and python code are using the same singleton instance. Because there're two Singleton::_instance if you export the Singleton class to Python. one at c++ side, the other at python side. I don't think this is