Re: [C++-sig] How to wrap class enums

2014-03-11 Thread Wichert Akkerman
On 10 Mar 2014, at 16:42, Liam Herron wrote: > Here is an example: > > // c++ code > > class A > { > public: > enum ATypes > { > ONE, > TWO, > THREE > }; > }; That is an enum in a class, which is an entirely different beast. Class enums are a C++11 addit

Re: [C++-sig] Type converter not found for property

2013-05-10 Thread Wichert Akkerman
On May 10, 2013, at 11:10 , Wichert Akkerman wrote: > On May 9, 2013, at 12:34 , Alex Leach wrote: >> On Thu, 09 May 2013 07:55:07 +0100, Wichert Akkerman >> wrote: >> >> On May 8, 2013, at 23:31 , "Alex Leach" wrote: >> >>> That error

Re: [C++-sig] Type converter not found for property

2013-05-10 Thread Wichert Akkerman
On May 9, 2013, at 12:42 , Alex Leach wrote: > On Thu, 09 May 2013 07:41:49 +0100, Wichert Akkerman > wrote: > >> If I try to do that by adding this: >> >> to_python_converter(); >> to_python_converter() >> >> I get a compile error: >

Re: [C++-sig] Type converter not found for property

2013-05-10 Thread Wichert Akkerman
On May 9, 2013, at 12:34 , Alex Leach wrote: > On Thu, 09 May 2013 07:55:07 +0100, Wichert Akkerman > wrote: > > > On May 8, 2013, at 23:31 , "Alex Leach" wrote: > >> That error means the type_id of uuid is not in the bp registry. >> >> I thi

Re: [C++-sig] Type converter not found for property

2013-05-08 Thread Wichert Akkerman
On May 8, 2013, at 23:31 , "Alex Leach" wrote: > That error means the type_id of uuid is not in the bp registry. > > I think you can fix this by deriving uuid_to_python from to_python_converter, > as demonstrated in the pytype_function example[1]. This will add the > get_pytype function call,

Re: [C++-sig] Type converter not found for property

2013-05-08 Thread Wichert Akkerman
On May 8, 2013, at 23:58 , Jim Bosch wrote: > On 05/08/2013 05:48 PM, Jim Bosch wrote: >> On 05/08/2013 04:33 PM, Wichert Akkerman wrote: >>> I am trying to expose a class with a boost::uuids::uuid member to Python. >>> The class is pretty simple: >>

[C++-sig] Type converter not found for property

2013-05-08 Thread Wichert Akkerman
I am trying to expose a class with a boost::uuids::uuid member to Python. The class is pretty simple: class Article { public: boost::uuids::uuid uuid; }; which is exposed like this: article .def(init((arg("uuid"))) .def_readwrite("uuid", &Article::uuid); and I have basic c

Re: [C++-sig] GC error due to stl_input_iterator

2013-02-07 Thread Wichert Akkerman
On Feb 6, 2013, at 14:30 , Wichert Akkerman wrote: > Which had an interesting result: the tests immediately aborted with a "Fatal > Python error: GC object already tracked" error. Commenting out the contents > of the if-statement in construct() made the problem go away, whic

[C++-sig] GC error due to stl_input_iterator

2013-02-06 Thread Wichert Akkerman
I am running into some unexpected errors when using stl_input_iterator. I have a fairly simple converter registered to convert an iterable list of values (custom enum) to a unordered_set. The code looks like this: struct advicetype_set_from_python { advicetype_set_from_python() {

Re: [C++-sig] bad exception conversion

2012-06-14 Thread Wichert Akkerman
On 06/14/2012 02:33 PM, Niall Douglas wrote: Do you think that this answer is worth adding to the BPL FAQ? Normally you don't need to derive from Python's Exception object, and indeed in my own custom exception implementations I never did so. However, if this has changed, an FAQ entry is appropri

Re: [C++-sig] bad exception conversion

2012-06-14 Thread Wichert Akkerman
On 06/14/2012 11:19 AM, Wichert Akkerman wrote: Hi Jim, On 06/14/2012 01:02 AM, Jim Bosch wrote: I suspect the problem is that your custom exception doesn't derived from Python's built-in Exception base class. Unfortunately, it's impossible to do that with a Boost.Python wra

Re: [C++-sig] bad exception conversion

2012-06-14 Thread Wichert Akkerman
Hi Jim, On 06/14/2012 01:02 AM, Jim Bosch wrote: I suspect the problem is that your custom exception doesn't derived from Python's built-in Exception base class. Unfortunately, it's impossible to do that with a Boost.Python wrapped class, but you can get it all done with the Python C API: n

[C++-sig] bad exception conversion

2012-06-13 Thread Wichert Akkerman
I have some glue code that calls a C++ function which can raise an unsuitable_error exception. I have an exception translator which will convert that to a more pythonic version (UnsuitableError), but when I use that I get an "SystemError: 'finally' pops bad exception" error on the python side.

Re: [C++-sig] A few questions on Boost.Python

2012-01-24 Thread Wichert Akkerman
On 01/23/2012 09:03 PM, Jim Bosch wrote: On 01/23/2012 02:35 PM, Bo Jensen wrote: Hi, I have been looking into the best way for me to make a python wrapper for a C++ library. Boost.Python looks nice and seem to fit my needs, but I have a few questions before I dig in deep and do the implemen

Re: [C++-sig] Multiple modules in a single pyd

2011-11-15 Thread Wichert Akkerman
On 11/15/2011 04:52 PM, Olivier Voyer wrote: Bingo! But I'm not sure how to do that... at this moment I'm using SWIG as a C++ wrapper. Do I only need to modify the __init__py file at the root of my package? Personally I don't have a single .py file for my extensions, I just drop in a single m

Re: [C++-sig] Multiple modules in a single pyd

2011-11-15 Thread Wichert Akkerman
On 11/15/2011 04:42 PM, Olivier Voyer wrote: Yes, that's exactly what I want to do. But, from what I understand, each module or submodule (.py file) must link to its own .pyd file, ie module1.py -> _module1.pyd, module2.py -> _module2.pyd. What I would really love to have is: myPackage/ myPac

Re: [C++-sig] Multiple modules in a single pyd

2011-11-15 Thread Wichert Akkerman
On 11/15/2011 03:51 PM, Jérôme Laheurte wrote: Le 15 nov. 2011 à 15:24, Jim Bosch a écrit : On Nov 15, 2011 8:53 AM, "Olivier Voyer" wrote: Hi everyone, Is it possible to have multiple modules linking to one single pyd file? I'm using SWIG with VS2010 and I can't find a way of doing that.

Re: [C++-sig] Custom smart pointer with const Types

2011-10-06 Thread Wichert Akkerman
#x27;re handling const objects. Wichert. -- Wichert AkkermanIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] How to configure makefile for different build platforms

2011-10-06 Thread Wichert Akkerman
On 10/06/2011 05:17 PM, David Aldrich wrote: > sys.version_info How would I get that from the command line please? python -c "import sys; print '%d.%d' % sys.version_info[:2]" ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.py

Re: [C++-sig] How to configure makefile for different build platforms

2011-10-06 Thread Wichert Akkerman
On 10/06/2011 05:08 PM, David Aldrich wrote: You can also extract this information from various methods in the distutils package. Even if you aren't using distutils to control the build, you could ask Python itself to print out the configuration variables. For instance: python -c "import dis

Re: [C++-sig] How to configure makefile for different build platforms

2011-10-06 Thread Wichert Akkerman
On 10/06/2011 03:09 PM, David Aldrich wrote: pkg-config does not use Debian packages names. Try using "python" for the current standard python 2 version, or pythonX.Y for specific versions. Boost appears to be installed in a standard location, so doesn't need any special compiler or linker option

Re: [C++-sig] How to configure makefile for different build platforms

2011-10-06 Thread Wichert Akkerman
On 10/06/2011 02:55 PM, David Aldrich wrote: On Ubuntu you can call pkg-config to figure out the right compiler and linker options for both Boost and Python. I would expect CentOS to support that as well. Hi Wichert Thanks for your suggestion. However, on my Ubuntu system: pkg-config --list-a

Re: [C++-sig] How to configure makefile for different build platforms

2011-10-05 Thread Wichert Akkerman
the different Python paths according to the build platform. On Ubuntu you can call pkg-config to figure out the right compiler and linker options for both Boost and Python. I would expect CentOS to support that as well. Wichert. -- Wichert AkkermanIt is simple to make things. http

Re: [C++-sig] map_indexing_suite does not find to-python convertors

2011-09-22 Thread Wichert Akkerman
On 09/22/2011 04:50 PM, Wichert Akkerman wrote: On 09/22/2011 04:31 PM, Jim Bosch wrote: On 09/22/2011 09:43 AM, Wichert Akkerman wrote: I am struggling to expose a map to python code. What I am doing is pretty simple: I have a map from an enum type to Glib::ustring, with a convertors

Re: [C++-sig] map_indexing_suite does not find to-python convertors

2011-09-22 Thread Wichert Akkerman
On 09/22/2011 04:31 PM, Jim Bosch wrote: On 09/22/2011 09:43 AM, Wichert Akkerman wrote: I am struggling to expose a map to python code. What I am doing is pretty simple: I have a map from an enum type to Glib::ustring, with a convertors registered to convert Python str and unicode instances to

[C++-sig] map_indexing_suite does not find to-python convertors

2011-09-22 Thread Wichert Akkerman
I am struggling to expose a map to python code. What I am doing is pretty simple: I have a map from an enum type to Glib::ustring, with a convertors registered to convert Python str and unicode instances to an ustring, and ustring to Python unicode. I've put the relevant code below. What I am

Re: [C++-sig] BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS default args core dump

2011-06-13 Thread Wichert Akkerman
p::arg("arg2")=10)) Nice, I had not discovered that anywhere in the documentation. Is there a similar construction that works for constructors as well? Wichert. -- Wichert AkkermanIt is simple to make things. http://www.wiggy.net/

Re: [C++-sig] compiling python extensions to work for multiple versions of python

2011-05-25 Thread Wichert Akkerman
On 5/25/11 17:21 , Karl Kuehn wrote: 1) Is this a limitation of Boost.Python? A trick from MySQL that I can emulate? Am I missing something obvious? I have tried a large number of variations in build commands using combinations of the following: This is a limitation of python, and I would be

Re: [C++-sig] C++ chain method works unexpectedly in Python

2011-04-18 Thread Wichert Akkerman
ython implementations. Wichert. -- Wichert AkkermanIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplu

Re: [C++-sig] boost::python::set missing?

2011-03-04 Thread Wichert Akkerman
On 3/2/11 00:50 , Ralf W. Grosse-Kunstleve wrote: I think that's a fine idea. (My guess is that it didn't make it into the boost.python API because it was added after the initial API had been designed.) That's exactly right. Boost.Python was developed when Python 2.2 had just come out. (Boos

[C++-sig] boost::python::set missing?

2011-03-01 Thread Wichert Akkerman
I noticed that the standard python set type is not exposed. Are there any plans to add that? Wichert. -- Wichert AkkermanIt is simple to make things. http://www.wiggy.net/ It is hard to make things simple. ___ Cplusplus-sig

Re: [C++-sig] Creating a unicode instrance from utf-8 encoded string

2011-02-21 Thread Wichert Akkerman
On 2/21/11 14:33 , Hans Meine wrote: Am Montag, 21. Februar 2011, um 11:36:52 schrieb Wichert Akkerman: I'm trying to do something which should be very simple, but I'm not having much luck figuring out how from the existing documentation. For a python 2 project I am trying to return

[C++-sig] Creating a unicode instrance from utf-8 encoded string

2011-02-21 Thread Wichert Akkerman
I'm trying to do something which should be very simple, but I'm not having much luck figuring out how from the existing documentation. For a python 2 project I am trying to return a gettext-translated string as a unicode instance to python. The return value for gettext() is a UTF-8 encoded cha