[C++-sig] unfriendly python error message (no line number)
amohr at pixar.com
amohr at pixar.com
Mon Nov 9 01:01:49 CET 2009
> No, it is not about template-related error messages :-)...
>
> I am wrapping a class:
> Obviously, the error is that I forgot '()' in the second get(). I
> am
> getting this error message:
>
> 0
> <bound method X.get of <Test.X object at 0x2b0db13d4cb0>>
>
> Is there a way to give user a more friendly error message in such
> case,
> with at least a line number where it happened?
This has nothing to do with boost.python. It's how python works. For example:
>>> class X(object):
def __init__(self):
self._x = 0
def get(self):
return self._x
>>> x = X()
>>> print x.get()
0
>>> print x.get
<bound method X.get of <__main__.X object at 0x02084FB0>>
And accessing 'x.get' is not in itself an error. You may want to pass that bound method to a function expecting a callable, for instance.
Alex
More information about the Cplusplus-sig
mailing list