AttributeError: ' ' object has no attribute ' '

Chris Angelico rosuav at
Sat Feb 23 23:03:54 CET 2013

On Sun, Feb 24, 2013 at 5:22 AM,  <matt.doolittle33 at> wrote:
> I am using Ubuntu 12.10, and Python 2.7.3, GNU Radio Companion v3.6.3.  I get the this error in terminal:
>  in __init__
>     self.wxgui_waterfallsink2_0.set_callback(wxgui_waterfallsink2_0_callback)
>   File "/usr/local/lib/python2.7/dist-packages/gnuradio/gr/", line 54, in __getattr__
>     return getattr(self._hb, name)
> AttributeError: 'gr_hier_block2_sptr' object has no attribute 'set_callback'
> I have been getting this error in multiple programs.  So what is stopping the program here?  There is no Attribute .set_callback obviously. But where is this attribute missing from exactly and how do i put it where it should be?

That's what the traceback is for. The 54th line in
is "return getattr(self._hb, name)", and on this particular run,
self._hb was a gr_hier_block2_sptr and name was set_callback. But from
the look of things, that's not the real problem; it seems to be a thin
wrapper around some other object, so you probably want to go up to the
previous entry in the traceback, which doesn't seem to be complete

>From the sound of things, you didn't write GNU Radio Companion. If
you're running a deployed application, exception tracebacks aren't
really your concern, and it's not your job to fix them. Is the program
working as expected? If not, raise a bug report with its maintainers,
and quote the whole traceback; its own developers will know what to do
with it. Even if everything seems to be working, it may be as well to
report it, as it may be concealing some other bug.

Of course, if you HAVE written some code around the GNU Radio
Companion (a script calling on it or somesuch), then the exception may
be of interest to you. Scroll up to see if the traceback ever names a
file that you've edited; if it does, ignore everything below there and
just look at the last line that you work with. That'll tell you, in
all probability, where it is you need to fix something.


More information about the Python-list mailing list