# TypeError for gr\_vector\_float arg

**URL:** <https://www.ruby-forum.com/t/typeerror-for-gr-vector-float-arg/231387>\
**Category:** GNU Radio\
**Created:** [August 5, 2014, 11:09pm UTC](https://www.ruby-forum.com/t/typeerror-for-gr-vector-float-arg/231387 "2014-08-05T23:09:40Z")\
**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:** [August 5, 2014, 11:09pm UTC](https://www.ruby-forum.com/t/typeerror-for-gr-vector-float-arg/231387/1 "2014-08-05T23:09:40Z")

</div>

Trying to get my OOT block to accept a vector of floats for filter taps.  
I used a couple in-tree blocks (mostly ofdm\_carier\_allocator and  
fir\_interpolator) for a quick reference. And I have fir interp/decim in  
my flowgraph and they have no issues at runtime. The flowgraph ran fine  
with my OOT block before I decided to try adding support for modifying  
the filter taps from GRC.

Now I am getting the following runtime error when starting the flowgraph  
in GRC:

Traceback (most recent call last):  
File “/usr/local/share/gnuradio-InTree-modules/ofdm\_tx\_rx.py”, line  
518, in   
tb = ofdm\_tx\_rx()  
File “/usr/local/share/gnuradio-InTree-modules/ofdm\_tx\_rx.py”, line  
314, in **init**  
self.comso\_ofdm\_rx\_0 = comso.ofdm\_rx((sync\_taps), nfft, ncp, nrp,  
nhst, thr, sel)  
File “/usr/local/lib64/python2.7/site-packages/comso/comso\_swig.py”,  
line 398, in make  
return \_comso\_swig.ofdm\_rx\_make(\*args, \*\*kwargs)  
TypeError: in method ‘ofdm\_rx\_make’, argument 1 of type ‘gr\_vector\_float  
const &’

It is really hard to find similar errors on the web, but there are a  
couple. None exact and not many where a solution is indicated. However,  
it seems likely that SWIG has a problem of some sort converting a tuple  
of floats in python (which is typically what the taps for filters look  
like that I have seen so far) to a vector in C++. Or, rather, it  
has a problem unless you take the required steps. I think there is the  
the equivalent of an include missing in SWIG? Something dot i with some  
syntax? I am brand new to SWIG and python.

I tried to add this capability to an existing OOT block of mine with a  
ton of existing code and did not want to start over with gr\_modtool  
which perhaps would have built the SWIG interfaces properly if it had  
known there would be a vector parameter involved. But that is probably  
what I will try next, just have to save off and paste stuff back in. I  
don’t know, I am guessing that may be the case and the reason why this  
is such a rarely found error.

But does anyone know what I need to do in order to make this run?

---

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [August 6, 2014, 7:55pm UTC](https://www.ruby-forum.com/t/typeerror-for-gr-vector-float-arg/231387/2 "2014-08-06T19:55:57Z")

</div>

On Tue, 5 Aug 2014 17:08:31 -0400  
John M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Trying to get my OOT block to accept a vector of floats for filter taps.  
> Traceback (most recent call last):  
> File “/usr/local/share/gnuradio-InTree-modules/ofdm\_tx\_rx.py”, line 518, in  
>   
> tb = ofdm\_tx\_rx()  
> File “/usr/local/share/gnuradio-InTree-modules/ofdm\_tx\_rx.py”, line 314, in  
> **init**  
> self.comso\_ofdm\_rx\_0 = comso.ofdm\_rx((sync\_taps), nfft, ncp, nrp, nhst, thr,  
> sel)  
> File “/usr/local/lib64/python2.7/site-packages/comso/comso\_swig.py”, line 398,  
> in make  
> return \_comso\_swig.ofdm\_rx\_make(\*args, \*\*kwargs)  
> TypeError: in method ‘ofdm\_rx\_make’, argument 1 of type ‘gr\_vector\_float const  
> &’

Heh… well… I tried again changing gr\_vector\_float to  
std::vector and that fixed this problem.  
Now, I did that a couple times before, but apparently it must have been  
when I still had some other issues.  
Still… seems odd that a typedef prevents SWIG from making this  
connection.  
And maybe I am still missing some header in the SWIG for gr\_vector\_\* but  
it works for a normal C++ vector.

But for now this is resolved and moving on.

---

<div class="post-metadata">

**Author:** ![jmaenpaa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/9de053/32.png) [@jmaenpaa](https://www.ruby-forum.com/u/jmaenpaa)\
**Post date:** [August 6, 2014, 9:38pm UTC](https://www.ruby-forum.com/t/typeerror-for-gr-vector-float-arg/231387/3 "2014-08-06T21:38:54Z")

</div>

On Wed, Aug 6, 2014 at 1:54 PM, John M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> nhst, thr, sel)  
> Still… seems odd that a typedef prevents SWIG from making this  
> connection.  
> And maybe I am still missing some header in the SWIG for gr\_vector\_\* but  
> it works for a normal C++ vector.
> 
> But for now this is resolved and moving on.

Yes, it can be tricky properly exporting some typedefs through swig.  
Also,  
though, we try not to use more typedefs than we really have to. Most of  
them, in fact, are slated for removal in version 3.8 and we’ll only be  
keeping the oft-used ones (like gr\_complex and the ones used in work  
functions).

Tom
