[C++-sig] Re: c++ to python automatic conversion

David Abrahams dave at boost-consulting.com
Mon Mar 8 22:24:27 CET 2004


Francois Ostiguy <ostiguy at fnal.gov> writes:

> Then, the following works fine (no error)
>
> Python 2.3.3 (#3, Mar  8 2004, 11:58:32)
> [GCC 3.3.3] on sunos5
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from demo import *
>>>> a = A()
>>>> b = a.makeB()
>>>> type(b)
> <class 'demo.B'>
>
> However, if I put class A and class B in two different files (modules) say
> demo1 and demo2 repectively, I get
>
> Python 2.3.3 (#3, Mar  8 2004, 11:58:32)
> [GCC 3.3.3] on sunos5
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from demo1 import A
>>>> from demo2 import B
>>>> a = A()
>>>> b = a.makeB()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: No Python class registered for C++ class B
>
> Do I have to provide an explicit converter ?
> Can you explain how this can be done ?
>
> As usual, any help is greatly appreciated.

What compiler did you use to build Boost.Python and your modules?

How did you build your modules?  Are they both linked to the same
libboost_python.so?

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list