[C++-sig] error accessing attribute

Jonathan Brandmeyer jbrandmeyer at earthlink.net
Tue Dec 30 21:36:54 CET 2003


On Tue, 2003-12-30 at 15:00, Stefan Seefeld wrote:
> hi there,
> 
> I'm compiling a python frontend for some classes, exposing
> a member variable (pointer to object) as a property in python.
> 
> Unfortunately, when I access that property, I get the error:
> 
> TypeError: bad argument type for built-in operation
> 
> What can cause this kind of error ? What built-in operation
> is meant here ? And what would be the argument ?
> 
> I'm sorry that I can't provide a more detailed description
> of the problem, unfortunately I could not yet reproduce the problem
> with a simple test case.
> 
> Is there any documentation (FAQ, wiki, whatever) that discusses
> often encountered error messages (which can get quite cryptic
> with the combination of python runtime binding and C++ template
> compile-time binding !) and their respective meaning / typical
> cause ?
> 
> Thanks a lot,
> 		Stefan

If you make a build of your project against the current CVS for
Boost.Python you will get much better error messages.  Otherwise, the
most common source of that error when accessing a property (for me,
anyway) is that you are calling the property's accessor with the wrong
signature, including passing an argument from Python that cannot be
converted to the required C++ type.

HTH,
Jonathan Brandmeyer





More information about the Cplusplus-sig mailing list