[py++] AttributeError: 'Boost.Python.StaticProperty' object attribute '__doc__' is read-only
Hi everybody, I have a small wrapper for a few geometry classes generated; it works on boost 1.34--1.37. I tried to compile and run on boost 1.39 (Boost::python doesn't seem to be mentioned in changelogs for 1.38 or 1.39 though) and I am getting this error: Traceback (most recent call last): File "debian/yade-bzr1703-dbg/usr/lib/yade-bzr1703-dbg/gui/PythonUI_rc.py", line 11, in <module> from miniWm3Wrap import * AttributeError: 'Boost.Python.StaticProperty' object attribute '__doc__' is read-only I only googled the same error at http://de.pastebin.ca/1535109 (which concerns pySide), but no solution. What am I doing wrong? Thanks, Vaclav
On Thu, Aug 20, 2009 at 5:10 AM, Vaclav Smilauer<eudoxos@arcig.cz> wrote:
Hi everybody,
I have a small wrapper for a few geometry classes generated; it works on boost 1.34--1.37. I tried to compile and run on boost 1.39 (Boost::python doesn't seem to be mentioned in changelogs for 1.38 or 1.39 though) and I am getting this error:
Traceback (most recent call last): File "debian/yade-bzr1703-dbg/usr/lib/yade-bzr1703-dbg/gui/PythonUI_rc.py", line 11, in <module> from miniWm3Wrap import * AttributeError: 'Boost.Python.StaticProperty' object attribute '__doc__' is read-only
I only googled the same error at http://de.pastebin.ca/1535109 (which concerns pySide), but no solution. What am I doing wrong?
Are you using Ubuntu 9.10 (karmic)? We are trying to fix the very same issue on PySide, and so far the problem seems only to happen on Karmic. On Ubuntu 9.04 (jaunty) the same binary package works fine. Regards, -- Anderson Lizardo OpenBossa Labs - INdT Manaus - Brazil
Are you using Ubuntu 9.10 (karmic)?
We are trying to fix the very same issue on PySide, and so far the problem seems only to happen on Karmic. On Ubuntu 9.04 (jaunty) the same binary package works fine.
Hi, yes, I am at ubuntu karmic. (It was me discussing that with you on IRC a few days back). By bisecting the (quite small) py++-generated wrapper that I use I found out that the problem is caused by def_readonly. If I comment them out, everything works fine. Isolating the offensive code (by hand): BOOST_PYTHON_MODULE(miniWm3Wrap){ typedef bp::class_< Wm3::Quaternion< double > > Quaternion_exposer_t; Quaternion_exposer_t Quaternion_exposer = Quaternion_exposer_t( "Quaternion", bp::init< >() ); // ... Quaternion_exposer.def_readonly( "IDENTITY", Wm3::Quaternion< double >::IDENTITY ); } the last line will cause the trouble. The decl&definition of Quaternion<double>::IDENTITY: // template in the header static const Quaternion IDENTITY; // in the .cpp template<> const Quaternion<double> Quaternion<double>::IDENTITY(1.0,0.0,0.0,0.0); If I have time, I will try to make minimum example exhibiting the bug. That should make it easier to find out what's gouing wrong. As an information for other people: this bug was consistently present at the mentioned ubuntu version (the future 9.10) regardless of complier/boost version, python 2.6.2. I wasn't able to reproduce it on debian/other ubuntu versions either. Hope we will be able to sort it out soon. Cheers, Vaclav
Such is the shortest example I am able to isolate (nothing py++ specific). Should I report that as bug? Against boost::python? I hope some expert will be able to comment on that. ---- $ cat foo.cc #include<boost/python.hpp> struct Foo{ static int bar; }; int Foo::bar=3; BOOST_PYTHON_MODULE(foo){ boost::python::class_<Foo>("Foo",boost::python::init<>()) .def_readonly("bar",Foo::bar); } $ g++ -o foo.so -I/usr/include/python2.6 -fPIC -shared -lboost_python-mt foo.cc $ PYTHONPATH=. python -c 'import foo' Traceback (most recent call last): File "<string>", line 1, in <module> AttributeError: 'Boost.Python.StaticProperty' object attribute '__doc__' is read-only
Hi guys, Searching in karmic patch for python 2.6, I found this one which touch in __doc__ attributes of python objects. (http://pastebin.com/m4d8008fa). I did not test if removing this boost will works fine. For fix this I did a little change removing the use of def_readonly("bar",Foo::bar) to add_property("bar", setter_property_bar). I will try find the problem in boost source but for now this change can solve the problem. BR Renato Araujo Oliveira Filho On Sun, Aug 30, 2009 at 4:40 AM, VáclavŠmilauer<eudoxos@arcig.cz> wrote:
Such is the shortest example I am able to isolate (nothing py++ specific). Should I report that as bug? Against boost::python?
I hope some expert will be able to comment on that.
----
$ cat foo.cc #include<boost/python.hpp> struct Foo{ static int bar; }; int Foo::bar=3;
BOOST_PYTHON_MODULE(foo){ boost::python::class_<Foo>("Foo",boost::python::init<>()) .def_readonly("bar",Foo::bar); }
$ g++ -o foo.so -I/usr/include/python2.6 -fPIC -shared -lboost_python-mt foo.cc $ PYTHONPATH=. python -c 'import foo' Traceback (most recent call last): File "<string>", line 1, in <module> AttributeError: 'Boost.Python.StaticProperty' object attribute '__doc__' is read-only
_______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig
participants (4)
-
Anderson Lizardo -
Renato Araujo -
Vaclav Smilauer -
Václav Šmilauer