[C++-sig] Strange problem with boost::python::scope
Lloyd Weehuizen
lloyd at fusion.net.nz
Mon Sep 3 03:21:58 CEST 2007
Hi There
I've run into an issue with the scope object that I don't understand.
I'm trying to defined class Y under class X similar to the scoping
examples as follows:
// No code, just a place holder class for scoping
class ElementNamespace {};
// Class with implementation
class DataGrid
{
};
python::scope element_scope( python::class_< ElementNamespace,
boost::noncopyable >( "element", python::no_init ) );
python::class_< DataGrid, ElementWrapper< DataGrid >,
boost::noncopyable, python::bases< Element > >("DataGrid",
python::init< const char* >())
...
;
I then try to inherit from DataGrid in python code as follows:
class CustomDataGrid(testmodule.element.DataGrid):
def __init__(self, tag):
testmodule.element.DataGrid.__init__(self, tag)
And I get the following error:
Traceback (most recent call last):
File "c:\projects\testmodule\datagrid.py", line 6, in __init__
testmodule.element.DataGrid.__init__(self, tag)
AttributeError: 'module' object has no attribute 'DataGrid'
Strangely enough the CustomDataGrid class inheritance finds the
object correctly, but calling the base initializer fails.
Any ideas?
Thanks,
Lloyd
More information about the Cplusplus-sig
mailing list