# Fwd: AttributeError: 'module' object has no attribute 'block\_name'

**URL:** <https://www.ruby-forum.com/t/fwd-attributeerror-module-object-has-no-attribute-block-name/234665>\
**Category:** GNU Radio\
**Created:** [March 20, 2015, 1:28am UTC](https://www.ruby-forum.com/t/fwd-attributeerror-module-object-has-no-attribute-block-name/234665 "2015-03-20T01:28:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [March 20, 2015, 1:28am UTC](https://www.ruby-forum.com/t/fwd-attributeerror-module-object-has-no-attribute-block-name/234665/1 "2015-03-20T01:28:16Z")

</div>

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._ [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Wed, Mar 18, 2015 at 10:07 PM  
To: removed\_email\_address@domain.invalid

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](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._ [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Thu, Mar 19, 2015 at 9:54 AM  
To: Mike H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

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

---

<div class="post-metadata">

**Author:** ![ghoti143](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@ghoti143](https://www.ruby-forum.com/u/ghoti143)\
**Post date:** [March 20, 2015, 1:29am UTC](https://www.ruby-forum.com/t/fwd-attributeerror-module-object-has-no-attribute-block-name/234665/2 "2015-03-20T01:29:08Z")

</div>

Tom,

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

Thanks again for your rapid response!!

Mike H.

---

<div class="post-metadata">

**Author:** ![ghoti143](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/90db22/32.png) [@ghoti143](https://www.ruby-forum.com/u/ghoti143)\
**Post date:** [March 20, 2015, 2:43pm UTC](https://www.ruby-forum.com/t/fwd-attributeerror-module-object-has-no-attribute-block-name/234665/3 "2015-03-20T14:43:30Z")

</div>

On Thu, Mar 19, 2015 at 8:24 PM, Mike H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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](http://gnuradio.org/redmine/projects/gnuradio/wiki/OutOfTreeModulesConfig)

Tom
