[C++-sig] Can't get Boost.Python to use extensions generated and wrapped with Py++

Roman Yakovenko roman.yakovenko at gmail.com
Tue Jul 17 07:23:06 CEST 2007


On 7/17/07, Lawrence Spector <Lawrence.Spector at canfieldsci.com> wrote:

> Any ideas what steps I've missed?  I've successfully built a few python
> extensions without using Boost.Python, but never successfully using a
> wrapper.  Am I missing something?
>

You didn't expose std::ostream class. So, when Boost.Python tries to
create an instance of your class in Python, it sees some argument type
it cannot treat. As a result, you've got an exception.

If you intend to create all your class instance in C++ than you can
exclude constructors.
In this case may be you can pass your object by reference, I am not
sure whether this will work:

TestClass testClass(std::cout, 3, 9.6f, 'Q');
boost::python::object pyTestClass(boost::ref( testClass) );

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/



More information about the Cplusplus-sig mailing list