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 <e>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 "<doctest test_extending[0]>", line 1, in <module>
        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 "<doctest test_extending[1]>", line 1, in <module>
        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 "<doctest test_extending[2]>", line 1, in <module>
        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 "<doctest test_extending[3]>", line 1, in <module>
        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 "<doctest test_extending[4]>", line 1, in <module>
        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 "<doctest test_extending[5]>", line 1, in <module>
        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 "<doctest test_extending[6]>", line 1, in <module>
        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 "<doctest test_extending[7]>", line 1, in <module>
        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 "<doctest test_extending[8]>", line 1, in <module>
        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@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 "<doctest test_extending[0]>", line 1, in <module>
        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 "<doctest test_extending[1]>", line 1, in <module>
        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 "<doctest test_extending[2]>", line 1, in <module>
        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 "<doctest test_extending[3]>", line 1, in <module>
        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 "<doctest test_extending[4]>", line 1, in <module>
        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 "<doctest test_extending[5]>", line 1, in <module>
        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 "<doctest test_extending[6]>", line 1, in <module>
        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 "<doctest test_extending[7]>", line 1, in <module>
        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 "<doctest test_extending[8]>", line 1, in <module>
        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@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 "<doctest test_extending[0]>", line 1, in <module>
        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 "<doctest test_extending[1]>", line 1, in <module>
        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 "<doctest test_extending[2]>", line 1, in <module>
        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 "<doctest test_extending[3]>", line 1, in <module>
        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 "<doctest test_extending[4]>", line 1, in <module>
        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 "<doctest test_extending[5]>", line 1, in <module>
        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 "<doctest test_extending[6]>", line 1, in <module>
        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 "<doctest test_extending[7]>", line 1, in <module>
        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 "<doctest test_extending[8]>", line 1, in <module>
        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 <http://www.eawag.ch/en/department/eco/main-focus/evolutionary-ecology/>- About me <http://www.eawag.ch/en/aboutus/portrait/organisation/staff/profile/hugo-mathe-hubert/>

Ü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.

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
https://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to