# Extra line in a module with python blocks

**URL:** <https://www.ruby-forum.com/t/extra-line-in-a-module-with-python-blocks/241246>\
**Category:** GNU Radio\
**Created:** [May 20, 2014, 2:27pm UTC](https://www.ruby-forum.com/t/extra-line-in-a-module-with-python-blocks/241246 "2014-05-20T14:27:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [May 20, 2014, 2:27pm UTC](https://www.ruby-forum.com/t/extra-line-in-a-module-with-python-blocks/241246/1 "2014-05-20T14:27:33Z")

</div>

Hi there,

I’m writing an OOT module. For now, the only block I’ve made is written  
in  
Python.  
I follow the guide and everythins is ok until I run the top\_block and  
get  
this error:

File “/usr/local/lib/python2.7/dist-packages/mavlink/ **init**.py”,  
line  
45, in   
from mavlink\_swig import \*

FYI, “mavlink” is the name of my module.

Now, if I comment that line out everything seems to work fine. Is this a  
serious issue or can I just go on using it this way?

---

<div class="post-metadata">

**Author:** ![Michal\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/77aa72/32.png) [@Michal\_J](https://www.ruby-forum.com/u/Michal_J)\
**Post date:** [May 20, 2014, 3:15pm UTC](https://www.ruby-forum.com/t/extra-line-in-a-module-with-python-blocks/241246/2 "2014-05-20T15:15:36Z")

</div>

On Tue, May 20, 2014 at 8:26 AM, Michal J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> FYI, “mavlink” is the name of my module.
> 
> Now, if I comment that line out everything seems to work fine. Is this a  
> serious issue or can I just go on using it this way?

I believe this issue has been corrected in recent weeks (Marcus Mueller  
I  
think handled it for us). No, if you just have Python blocks, then you  
do  
not require the “from xxx\_swig import \*” line, so you should be fine.  
Just  
remember that you’ve done this if you ever add a C++ block to your  
project.

Tom

---

<div class="post-metadata">

**Author:** ![Michal\_J](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/77aa72/32.png) [@Michal\_J](https://www.ruby-forum.com/u/Michal_J)\
**Post date:** [May 20, 2014, 3:43pm UTC](https://www.ruby-forum.com/t/extra-line-in-a-module-with-python-blocks/241246/3 "2014-05-20T15:43:20Z")

</div>

Hi Tom, hi Michael,

jep, fixed that, and my pull request was recently merged (thanks,  
jcorgan 😉 ).

Sadly, the fix only applies to new modules, but the fix is basically the  
same as commenting that line out.

Instead of commenting it out, you can be safe that your module will also  
respect C++ blocks if you add some later, you can try-except-surround  
that import statement like:

try:  
from mavlink\_swig import \*  
except ImportError as e:  
pass

(compare [1])

Greetings,  
Marcus

[1]

> <https://github.com/marcusmueller/gnuradio/commit/06023871a7966101a5e50d4d906628ecaecf94f0>
>
> \_\_init\_\_.py used to throw an ImportError when trying to load
> a python-only OOT m…odule.
