Fwd: AttributeError: 'module' object has no attribute 'block_name'

Tom,

I sincerely apologize if I have posted this email to the wrong location
but
this is where the web page sent me.

I have forwarded my original email below and hope it shows up as you
expected.

Any info you can provide on this problem would be greatly appreciated.

Thanks!
Mike H.

Forwarded conversation
Subject: Re: [Discuss-gnuradio] AttributeError: ‘module’ object has no
attribute ‘block_name’

From: Mike H. [email protected]
Date: Wed, Mar 18, 2015 at 10:07 PM
To: [email protected]

Sir,

I am having the exact same issues as those discussed in this thread and
have not found any solutions that work. I apologize for the
strange-ness
of the email but we’ve been struggling with this problem for several
days.

First, I have GNU Radio 3.7.5.1 installed on three different Laptops
each
running 64-bit Ubuntu. GNURadio was installed using the ‘apt-get’
install
call for gnuradio with no other modifications. The steps below will
produce this exact problem on every machine we have tried it on.

Step 1.
Pick any GNU Radio Tutorial such as the ‘square2_ff’ Tutorial. Follow
all
the steps exactly as indicated to create the basic block. Compile and
install the block into GNURadio following the steps in the Tutorial.
Run
the Block in GNURadio. The Block should work in GNURadio exactly as
indicated in the Tutorial. Great Tutorial by the way!

Step 2.
Now, completely exit GNURadio. Open the ‘square2_ff_impl.cc’ file (or
whatever your implementation file is) and add (any) one of the C++ API
Class Headers such as:
#include <gnuradio/filter/fir_filter_fff.h
http://gnuradio.org/doc/doxygen/fir__filter__fff_8h_source.html>

Next, in the constructor for square2_ff_impl add a single line to
instantiate a filter object such as:
gr::filter::fir_filter_fff::sptr
filter(gr::filter::fir_filter_fff::make(1,m_taps));

Make sure the ‘m_taps’ vector does in fact hold values but don’t do
anything else here. Just declare a variable of the C++ API Class you
picked. Do not modify any other files than the .cc file.

Step 3.
Following this, compile the Block code and install the Block into
GNURadio
again following the exact same steps from the Tutorial as before. The
Test
Steps on my machine do not indicate any errors here, which is adding to
my
confusions.

Step 4.
Open GNURadio and try running the ‘square2_ff’ (or whatever yours is
called) Block again.
Now, with every machine I’ve tried this on, you will get the error:
AttributeError:‘module’ object has no attribute ‘square2_ff’

Following this, exit GNURadio completely.

Step 5.
Open the source module ‘square2_ff_impl.cc’ file again and comment out
only
the line where you instantiated the ‘filter’ object. Leave the #include
for ‘fir_filter_fff.h’ alone. Recompile and reinstall the Block back
into
GNURadio following the Tutorial steps as before. Don’t modify anything
else other than the .cc file.

Step 6.
Open GNURadio again and try the square2_ff block again. This time it
works
exactly as it should with no errors.

For some reason, the C++ OOT Blocks will not run inside GNU Radio if I
try
to use any of the C++ API Classes in the implementation code. I’ve
tried
everything I can think to move the declarations/headers around but
nothing
works. Granted, I have not tried every single API Class but I’ve tried
enough to know it doesn’t work. I do not touch any of the swig or
python
files or XML files. The only file I touch is the implementation file
and
this is enough to cause this error.

What am I doing wrong here? This problem is all over the internet but
none
of the solutions offered seem to work on any machine I try them on??

Any help on this would be greatly appreciated.

Thanks,
Mike H


From: Tom R. [email protected]
Date: Thu, Mar 19, 2015 at 9:54 AM
To: Mike H. [email protected]

Hi Mike,

I have the answer for you, but it’s our policy not to answer these
questions off the mailing list. Could you please post this to the ML,
instead, and I can answer it there?

And I really appreciate the detail you went through to help me recreate
and
understand the issue.

Tom

Tom,

I hope I put this question into the correct location on the Mailing
List.

Thanks again for your rapid response!!

Mike H.

On Thu, Mar 19, 2015 at 8:24 PM, Mike H. [email protected] wrote:

Thanks!
Mike H.

No worries. We just like to make sure that all questions and answers are
public. See below.

Sir,
Step 1.
#include <gnuradio/filter/fir_filter_fff.h

AttributeError:‘module’ object has no attribute ‘square2_ff’
Step 6.

What am I doing wrong here? This problem is all over the internet but
none of the solutions offered seem to work on any machine I try them on??

Any help on this would be greatly appreciated.

Thanks,
Mike H

When you build an OOT module, it only knows to look for and link against
the GNU Radio runtime library. If you look in the top-level
CMakeLists.txt
file of your project, you’ll see a line (somewhere around line 113) that
declares this:

set(GR_REQUIRED_COMPONENTS RUNTIME)

But now you are trying to use an FFT filter, which is in the GNU Radio
filter library (libgnuradio-filter). You need to tell the project to
both
find and link against this library now, so change that line to:

set(GR_REQUIRED_COMPONENTS RUNTIME FILTER)

For future reference, nearly this exact problem is mentioned in out OOT
configuration tutorial:

http://gnuradio.org/redmine/projects/gnuradio/wiki/OutOfTreeModulesConfig

Tom