From hugomh at gmx.fr Fri Jan 13 08:53:53 2017 From: hugomh at gmx.fr (hmh) Date: Fri, 13 Jan 2017 14:53:53 +0100 Subject: [C++-sig] No-Install Quickstart failure Message-ID: Hi all, I am trying to add some simple and small C++11 functions to a python3 project. To this end, I am trying to use "Boost.Python", and at first I am trying to follow the "No-Install Quickstart" guide (https://boostorg.github.io/python/doc/html/building/no_install_quickstart.html). But I failled. I am using Ubuntu 16.04, and Python 3.5 although I also have Python 2.7 installed. (My python project need Python 3) Details are hereafter. Thanks for your help ! hugo Below is what I have done, with the long outputs: 1) download and unzip boost_1_63_0.tar.gz from https://sourceforge.net/projects/boost/files/boost/1.63.0/ 2) Move in ./boost_1_63_0 and run bootstrap.sh which output is: Building Boost.Build engine with toolset gcc... tools/build/src/engine/bin.linuxx86_64/b2 Detecting Python version... 2.7 Detecting Python root... /usr Unicode/ICU support for Boost.Regex?... not found. Generating Boost.Build configuration in project-config.jam... Bootstrapping is done. To build, run: ./b2 To adjust configuration, edit 'project-config.jam'. Further information: - Command line help: ./b2 --help - Getting started guide: http://www.boost.org/more/getting_started/unix-variants.html - Boost.Build documentation: http://www.boost.org/build/doc/html/index.html 3) move to ./boost_1_63_0/libs/python/example/quickstart 4) runnig bjamtoolset=gcc--verbose-testtest which output is: warning: mismatched versions of Boost.Build engine and core warning: Boost.Build engine (bjam) is 2014.03.00 warning: Boost.Build core (at /mnt/Daten/supr/Untitled Folder/boost_1_63_0/tools/build/src) is 2015.07-git notice: could not find main target test notice: assuming it is a name of file to create. Performing configuration checks - 32-bit : no - 64-bit : yes - arm : no - mips1 : no - power : no - sparc : no - x86 : yes Building the Boost C++ Libraries. - symlinks supported : yes - C++11 mutex : no - lockfree boost::atomic_flag : yes - Boost.Config Feature Check: cxx11_auto_declarations : no - Boost.Config Feature Check: cxx11_constexpr : no - Boost.Config Feature Check: cxx11_defaulted_functions : no - Boost.Config Feature Check: cxx11_final : yes - Boost.Config Feature Check: cxx11_hdr_mutex : no - Boost.Config Feature Check: cxx11_hdr_tuple : no - Boost.Config Feature Check: cxx11_lambdas : no - Boost.Config Feature Check: cxx11_noexcept : no - Boost.Config Feature Check: cxx11_nullptr : no - Boost.Config Feature Check: cxx11_rvalue_references : no - Boost.Config Feature Check: cxx11_template_aliases : no - Boost.Config Feature Check: cxx11_thread_local : no - Boost.Config Feature Check: cxx11_variadic_templates : yes - has_icu builds : yes warning: Graph library does not contain MPI-based parallel components. note: to enable them, add "using mpi ;" to your user-config.jam - zlib : yes - bzip2 : yes - iconv (libc) : yes - icu : yes - native-atomic-int32-supported : yes - native-syslog-supported : yes - pthread-supports-robust-mutexes : yes - compiler-supports-visibility : yes - compiler-supports-ssse3 : yes - compiler-supports-avx2 : yes - gcc visibility : yes - long double support : yes warning: skipping optional Message Passing Interface (MPI) library. note: to enable MPI support, add "using mpi ;" to user-config.jam. note: to suppress this message, pass "--without-mpi" to bjam. note: otherwise, you can safely ignore this message. - zlib : yes - bzip2 : yes don't know how to make test ...found 1 target... ...can't find 1 target... Then, it is mentioned in the tutorial that "If you followed this procedure successfully, you will have built an extension module called |extending| and tested it by running a Python script called |test_extending.py|. You will also have built and run a simple application called |embedding| that embeds python." I am not sure whether this has been tried or not, thus, I executed: python2.7 ./libs/python/example/quickstart/test_extending.py But, I get similar results with : python3.5 ./libs/python/example/quickstart/test_extending.py Trying: from extending import * Expecting nothing ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 7, in test_extending Failed example: from extending import * Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in from extending import * ImportError: No module named extending Trying: hi = hello('California') Expecting nothing ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 8, in test_extending Failed example: hi = hello('California') Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in hi = hello('California') NameError: name 'hello' is not defined Trying: hi.greet() Expecting: 'Hello from California' ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 9, in test_extending Failed example: hi.greet() Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in hi.greet() NameError: name 'hi' is not defined Trying: invite(hi) Expecting: 'Hello from California! Please come soon!' ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 11, in test_extending Failed example: invite(hi) Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in invite(hi) NameError: name 'invite' is not defined Trying: hi.invite() Expecting: 'Hello from California! Please come soon!' ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 13, in test_extending Failed example: hi.invite() Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in hi.invite() NameError: name 'hi' is not defined Trying: class wordy(hello): def greet(self): return hello.greet(self) + ', where the weather is fine' Expecting nothing ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 16, in test_extending Failed example: class wordy(hello): def greet(self): return hello.greet(self) + ', where the weather is fine' Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in class wordy(hello): NameError: name 'hello' is not defined Trying: hi2 = wordy('Florida') Expecting nothing ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 20, in test_extending Failed example: hi2 = wordy('Florida') Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in hi2 = wordy('Florida') NameError: name 'wordy' is not defined Trying: hi2.greet() Expecting: 'Hello from Florida, where the weather is fine' ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 21, in test_extending Failed example: hi2.greet() Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in hi2.greet() NameError: name 'hi2' is not defined Trying: invite(hi2) Expecting: 'Hello from Florida! Please come soon!' ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 23, in test_extending Failed example: invite(hi2) Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in invite(hi2) NameError: name 'invite' is not defined 1 items had no tests: test_extending.run ********************************************************************** 1 items had failures: 9 of 9 in test_extending 9 tests in 2 items. 0 passed and 9 failed. ***Test Failed*** 9 failures. hmh at hmh-All-Series:/mnt/Daten/supr/Untitled Folder/boost_1_63_0$ python3.5 /supr/Untitled\ Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py Trying: from extending import * Expecting nothing ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 7, in test_extending Failed example: from extending import * Exception raised: Traceback (most recent call last): File "/usr/lib/python3.5/doctest.py", line 1321, in __run compileflags, 1), test.globs) File "", line 1, in from extending import * ImportError: No module named 'extending' Trying: hi = hello('California') Expecting nothing ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 8, in test_extending Failed example: hi = hello('California') Exception raised: Traceback (most recent call last): File "/usr/lib/python3.5/doctest.py", line 1321, in __run compileflags, 1), test.globs) File "", line 1, in hi = hello('California') NameError: name 'hello' is not defined Trying: hi.greet() Expecting: 'Hello from California' ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 9, in test_extending Failed example: hi.greet() Exception raised: Traceback (most recent call last): File "/usr/lib/python3.5/doctest.py", line 1321, in __run compileflags, 1), test.globs) File "", line 1, in hi.greet() NameError: name 'hi' is not defined Trying: invite(hi) Expecting: 'Hello from California! Please come soon!' ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 11, in test_extending Failed example: invite(hi) Exception raised: Traceback (most recent call last): File "/usr/lib/python3.5/doctest.py", line 1321, in __run compileflags, 1), test.globs) File "", line 1, in invite(hi) NameError: name 'invite' is not defined Trying: hi.invite() Expecting: 'Hello from California! Please come soon!' ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 13, in test_extending Failed example: hi.invite() Exception raised: Traceback (most recent call last): File "/usr/lib/python3.5/doctest.py", line 1321, in __run compileflags, 1), test.globs) File "", line 1, in hi.invite() NameError: name 'hi' is not defined Trying: class wordy(hello): def greet(self): return hello.greet(self) + ', where the weather is fine' Expecting nothing ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 16, in test_extending Failed example: class wordy(hello): def greet(self): return hello.greet(self) + ', where the weather is fine' Exception raised: Traceback (most recent call last): File "/usr/lib/python3.5/doctest.py", line 1321, in __run compileflags, 1), test.globs) File "", line 1, in class wordy(hello): NameError: name 'hello' is not defined Trying: hi2 = wordy('Florida') Expecting nothing ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 20, in test_extending Failed example: hi2 = wordy('Florida') Exception raised: Traceback (most recent call last): File "/usr/lib/python3.5/doctest.py", line 1321, in __run compileflags, 1), test.globs) File "", line 1, in hi2 = wordy('Florida') NameError: name 'wordy' is not defined Trying: hi2.greet() Expecting: 'Hello from Florida, where the weather is fine' ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 21, in test_extending Failed example: hi2.greet() Exception raised: Traceback (most recent call last): File "/usr/lib/python3.5/doctest.py", line 1321, in __run compileflags, 1), test.globs) File "", line 1, in hi2.greet() NameError: name 'hi2' is not defined Trying: invite(hi2) Expecting: 'Hello from Florida! Please come soon!' ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 23, in test_extending Failed example: invite(hi2) Exception raised: Traceback (most recent call last): File "/usr/lib/python3.5/doctest.py", line 1321, in __run compileflags, 1), test.globs) File "", line 1, in invite(hi2) NameError: name 'invite' is not defined 1 items had no tests: test_extending.run ********************************************************************** 1 items had failures: 9 of 9 in test_extending 9 tests in 2 items. 0 passed and 9 failed. ***Test Failed*** 9 failures. hmh at hmh-All-Series:/mnt/Daten/supr/Untitled Folder/boost_1_63_0$ python2.7 /supr/Untitled\ Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py Trying: from extending import * Expecting nothing ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 7, in test_extending Failed example: from extending import * Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in from extending import * ImportError: No module named extending Trying: hi = hello('California') Expecting nothing ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 8, in test_extending Failed example: hi = hello('California') Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in hi = hello('California') NameError: name 'hello' is not defined Trying: hi.greet() Expecting: 'Hello from California' ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 9, in test_extending Failed example: hi.greet() Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in hi.greet() NameError: name 'hi' is not defined Trying: invite(hi) Expecting: 'Hello from California! Please come soon!' ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 11, in test_extending Failed example: invite(hi) Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in invite(hi) NameError: name 'invite' is not defined Trying: hi.invite() Expecting: 'Hello from California! Please come soon!' ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 13, in test_extending Failed example: hi.invite() Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in hi.invite() NameError: name 'hi' is not defined Trying: class wordy(hello): def greet(self): return hello.greet(self) + ', where the weather is fine' Expecting nothing ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 16, in test_extending Failed example: class wordy(hello): def greet(self): return hello.greet(self) + ', where the weather is fine' Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in class wordy(hello): NameError: name 'hello' is not defined Trying: hi2 = wordy('Florida') Expecting nothing ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 20, in test_extending Failed example: hi2 = wordy('Florida') Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in hi2 = wordy('Florida') NameError: name 'wordy' is not defined Trying: hi2.greet() Expecting: 'Hello from Florida, where the weather is fine' ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 21, in test_extending Failed example: hi2.greet() Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in hi2.greet() NameError: name 'hi2' is not defined Trying: invite(hi2) Expecting: 'Hello from Florida! Please come soon!' ********************************************************************** File "/mnt/Daten/supr/Untitled Folder/boost_1_63_0/libs/python/example/quickstart/test_extending.py", line 23, in test_extending Failed example: invite(hi2) Exception raised: Traceback (most recent call last): File "/usr/lib/python2.7/doctest.py", line 1315, in __run compileflags, 1) in test.globs File "", line 1, in invite(hi2) NameError: name 'invite' is not defined 1 items had no tests: test_extending.run ********************************************************************** 1 items had failures: 9 of 9 in test_extending 9 tests in 2 items. 0 passed and 9 failed. ***Test Failed*** 9 failures. -- - no title specified Hugo Math?-Hubert BU-G19 postdoc eawag (Swiss Federal Institute of Aquatic Science and Technology) Evolutionary Ecology - About me ?berlandstrasse 133 P.O.Box 611 8600 D?bendorf, Switzerland - - - - - - - - - - - - - - - - - - Thoughts appear from doubts and die in convictions. Therefore, doubts are an indication of strength and convictions an indication of weakness. Yet, most people believe the opposite. - - - - - - - - - - - - - - - - - - Les r?flexions naissent dans les doutes et meurent dans les certitudes. Les doutes sont donc un signe de force et les certitudes un signe de faiblesse. La plupart des gens sont pourtant certains du contraire. -------------- next part -------------- An HTML attachment was scrubbed... URL: From samh1218 at gmail.com Mon Jan 16 12:04:49 2017 From: samh1218 at gmail.com (H Sam) Date: Mon, 16 Jan 2017 12:04:49 -0500 Subject: [C++-sig] Having Trouble Running Boost.Python Tutorial Message-ID: Hello, I am trying to run the Boost.Python tutorial, as shown in the documentation : http://www.boost.org/doc/libs/1_63_0/libs/python/doc/html/building/no_install_quickstart.html . I am getting this error : D:\local\boost_1_63_0\libs\python\example\quickstart>bjam ...found 17 targets... ...updating 6 targets... compile-c-c++ extending.obj extending.cpp extending.cpp(5): fatal error C1083: Cannot open include file: 'boost/python/class.hpp': No such file or directory call "C:\Users\Sam\AppData\Local\Temp\b2_msvc_14.0_vcvarsall_x86.cmd" >nul cl /Zm800 -nologo @"extending.obj.rsp" ...failed compile-c-c++ extending.obj... ...skipped extending.dll for lack of extending.obj... ...skipped extending.pdb for lack of extending.obj... compile-c-c++ embedding.obj embedding.cpp embedding.cpp(6): fatal error C1083: Cannot open include file: 'boost/python.hpp': No such file or directory call "C:\Users\Sam\AppData\Local\Temp\b2_msvc_14.0_vcvarsall_x86.cmd" >nul cl /Zm800 -nologo @"embedding.obj.rsp" ...failed compile-c-c++ embedding.obj... ...skipped embedding.exe for lack of embedding.obj... ...skipped embedding.pdb for lack of embedding.obj... ...failed updating 2 targets... ...skipped 4 targets... Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From meagher.kevin at gmail.com Wed Jan 18 07:54:32 2017 From: meagher.kevin at gmail.com (Kevin Meagher) Date: Wed, 18 Jan 2017 13:54:32 +0100 Subject: [C++-sig] numpy.float32 with boost python Message-ID: Hi I get an exception when numpy.float32 are passed to c++ functions that are expecting a float. I have provided a trivial example #include > #include > double sq(double x){ return x*x;} > BOOST_PYTHON_MODULE(sq) > { > boost::python::def("sq",sq); > } > When i run it with : from sq import sq import numpy as np > print sq(3.) #fine print sq(np.float64(3.)); #fine print sq(np.float32(3.)); #dosn't work I get: 9.0 > 9.0 > Traceback (most recent call last): > File "sq.py", line 6, in > print sq(np.float32(3.)); #dosn't work > Boost.Python.ArgumentError: Python argument types in > sq.sq(numpy.float32) > did not match C++ signature: > sq(double) I know these are different types and I can just recast the input to float64, but I assumed that a float32->float64 conversion would be automatic in this case. Is this the way it is supposed to work? Is there a way to make an explicit conversion happen? Thanks, Kevin Meagher -------------- next part -------------- An HTML attachment was scrubbed... URL: From lzyl888 at gmail.com Wed Jan 18 23:04:58 2017 From: lzyl888 at gmail.com (=?UTF-8?B?5aWH55yf5Lqm5YGH?=) Date: Thu, 19 Jan 2017 12:04:58 +0800 Subject: [C++-sig] Is there anybody has idea about access the set from python? Message-ID: It's strange that boost::python don't support boost::python::set. Set is a very usable structure, so is there any idea about it? How to convert a python::set to a std::set or any other hash-able structure? Btw, how about boost::python::dict's performance? Does it implemented by hash-table? Thanks for any reply. -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan at seefeld.name Thu Jan 19 15:23:45 2017 From: stefan at seefeld.name (Stefan Seefeld) Date: Thu, 19 Jan 2017 15:23:45 -0500 Subject: [C++-sig] Is there anybody has idea about access the set from python? In-Reply-To: References: Message-ID: On 18.01.2017 23:04, ???? wrote: > It's strange that boost::python don't support boost::python::set. Indeed, a wrapper type for that is missing. Feel free to submit a patch. > Set is a very usable structure, so is there any idea about it? How to > convert a python::set to a std::set or any other hash-able structure? Converting python sets to C++ should be done by custom converters, as I doubt there is a single way to do it that would meet everyone's requirement. > Btw, how about boost::python::dict's performance? Does it implemented > by hash-table? All boost::python object types are thin wrappers around their Python counterparts, i.e. a boost::python::dict simply wraps a Python dict. See http://boostorg.github.io/python/doc/html/tutorial/tutorial/object.html#tutorial.object.derived_object_types Stefan -- ...ich hab' noch einen Koffer in Berlin... From lzyl888 at gmail.com Thu Jan 19 19:48:33 2017 From: lzyl888 at gmail.com (=?UTF-8?B?5aWH55yf5Lqm5YGH?=) Date: Fri, 20 Jan 2017 08:48:33 +0800 Subject: [C++-sig] Is there anybody has idea about access the set from python? In-Reply-To: References: Message-ID: Thank you very much. You really do me a lot. As I know, it seems that boost::python::set has missed for several years. 2017-01-20 4:23 GMT+08:00 Stefan Seefeld : > On 18.01.2017 23:04, ???? wrote: > > It's strange that boost::python don't support boost::python::set. > > Indeed, a wrapper type for that is missing. Feel free to submit a patch. > > > Set is a very usable structure, so is there any idea about it? How to > > convert a python::set to a std::set or any other hash-able structure? > > Converting python sets to C++ should be done by custom converters, as I > doubt there is a single way to do it that would meet everyone's > requirement. > > > Btw, how about boost::python::dict's performance? Does it implemented > > by hash-table? > > All boost::python object types are thin wrappers around their Python > counterparts, i.e. a boost::python::dict simply wraps a Python dict. > See > http://boostorg.github.io/python/doc/html/tutorial/ > tutorial/object.html#tutorial.object.derived_object_types > > Stefan > > > -- > > ...ich hab' noch einen Koffer in Berlin... > > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig at python.org > https://mail.python.org/mailman/listinfo/cplusplus-sig -------------- next part -------------- An HTML attachment was scrubbed... URL: From stefan at seefeld.name Fri Jan 20 10:32:02 2017 From: stefan at seefeld.name (Stefan Seefeld) Date: Fri, 20 Jan 2017 10:32:02 -0500 Subject: [C++-sig] Is there anybody has idea about access the set from python? In-Reply-To: References: Message-ID: <161fc56e-667f-10b7-86bd-575d02d71fb2@seefeld.name> On 19.01.2017 19:48, ???? wrote: > Thank you very much. You really do me a lot. > > As I know, it seems that boost::python::set has missed for several years. Right. I'll see whether I can add it for the next release. (Note, though, that this is only a convenience interface. There is nothing you can't already do using the boost::python::object interface. It's just a bit more concise to have a dedicated high-level wrapper type for 'set'.) Stefan -- ...ich hab' noch einen Koffer in Berlin... From skip.montanaro at gmail.com Mon Jan 23 15:47:56 2017 From: skip.montanaro at gmail.com (Skip Montanaro) Date: Mon, 23 Jan 2017 14:47:56 -0600 Subject: [C++-sig] Fwd: Wrapping a singleton using pybind11? In-Reply-To: References: Message-ID: Looking around for help with pybind11, I saw a brief flurry of activity related to it here back in Oct 2015, when Wenzel Jakob introduced it. Since then, not so much. I'm trying to come up-to-speed with it, though I'm not a C++ programmer, so it's been a slow slog so far. Almost the first thing I tried to do has me stumped. I have a singleton class (no public constructor, C++ programmers call an instance() member function). As a Python programmer, that seems crude to me. In Python, I'd write a __new__ method and let programmers pretend they have different instances. We already have some Boost.Python wrappers for parts of our C++ libraries. The general strategy there seems to be to create a second struct which does have a constructor and a bunch of one-line member functions, then use .def(py::init<>()) That also seems crude, *and* makes me have to repeat myself. For every member function (static or otherwise) that I want to expose, not only do I have to add the necessary .def(...) call, I have to also add a silly member function to that artificial struct created to provide a public constructor. (And since they are structurally separate, I can't even use preprocessor macros to expand things.) Is there an straightforward way to wrap a singleton class using pybind11 which minimizes the amount of boilerplate I have to write? I thought I'd be able to figure out type converters, then write a few .def(...) calls, and be done with it. That's turning out not to be the case, at least not for me. I suppose if was an actual C++ programmer, I would be further along at this point. Thanks, Skip Montanaro From Xavier.ARTUSI at cea.fr Mon Jan 23 08:48:46 2017 From: Xavier.ARTUSI at cea.fr (ARTUSI Xavier) Date: Mon, 23 Jan 2017 13:48:46 +0000 Subject: [C++-sig] build Boost.Python v 1.63 numpy shared .lib missing Message-ID: <0D5F19877C48EF49B26555531451FD0F0BA3C5E0@EXDAG0-B0.intra.cea.fr> Hello, I tried to build Boost.Python v 1.63 shared libraries. With : - msvc=12.0 - Python 3.4 - Numpy 1.11 Compilation seems fine except for numpy libs which not seems to be created. Here is the end of the building log. msvc.link.dll bin.v2\libs\python\build\msvc-12.0\release\address-model-64\threading-multi\boost_numpy3-vc120-mt-1_63.dll msvc.manifest.dll bin.v2\libs\python\build\msvc-12.0\release\address-model-64\threading-multi\boost_numpy3-vc120-mt-1_63.dll common.copy stage\lib\boost_numpy3-vc120-mt-1_63.dll bin.v2\libs\python\build\msvc-12.0\release\address-model-64\threading-multi\boost_numpy3-vc120-mt-1_63.dll 1 fichier(s) copi?(s). common.copy stage\lib\boost_numpy3-vc120-mt-1_63.libLe fichier sp?cifi? est introuvable. copy /b "bin.v2\libs\python\build\msvc-12.0\release\address-model-64\threading-multi\boost_numpy3-vc120-mt-1_63.lib" + this-file-does-not-exist-A698EE780689 9E69 "stage\lib\boost_numpy3-vc120-mt-1_63.lib" ...failed common.copy stage\lib\boost_numpy3-vc120-mt-1_63.lib... ...failed updating 4 targets... ...updated 100 targets... Greetings, Xavier Artusi. PS : There is no problems with static libraries. -------------- next part -------------- An HTML attachment was scrubbed... URL: