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

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Mon Mar 8 23:03:46 CET 2004


This reminds me of the serious trouble I had with FSF gcc (i.e. *not* Apple's
port) under Mac OS X. See here:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14232

To check if you have a similar same problem edit the file

boost/libs/python/src/converter/registry.cpp

Somewhere near the top insert:

#define BOOST_PYTHON_TRACE_REGISTRY

Recompile and relink libboost_python.so. Run your simple test and post the
output.

I hope this is not it but trying this out will only take a few minutes.

Ralf


--- David Abrahams <dave at boost-consulting.com> wrote:
> 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?


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree




More information about the Cplusplus-sig mailing list