Friday, January 15, 2021

Re: (gnuradio3.8) module 'gnuradio.blocks' has no attribute 'message_sink'

So, the old msg_queue infrastructure of GNU Radio has been removed, yes.

A suitable replacement are the asynchronous message passing blocks.
Depending on your use case, the conversion of your code should be
relatively straightforward - the message debug sink might even do what
you want.

Best regards,
Marcus

On 07.01.21 04:46, Ting Wu wrote:
> Hi!
>
> I recently upgraded to gnuradio 3.8 and my old code threw the following
> error:
>
> module 'gnuradio.blocks' has no attribute 'message_sink'
>
> Is the 'message_sink' has been deprecated in the recent version of
> gnuradio? If so, what should I use now for the message source and sink?
> I really do not want to rewrite all the codes, so I would be really
> grateful if there is a simple way to make the following code work with
> the recent version of gnuradio. The code simply gets data stream from a
> USRP N200 (LFRX daughterboard).
>
> =================================================
>  class my_block(gr.top_block):
>     def __init__(self):
>         gr.top_block.__init__(self)
>         self.source = uhd.usrp_source(device_addr="",
> stream_args=uhd.stream_args('sc16', 'sc16', args="scalar=1024"))
>
>         self.source.set_samp_rate(samp_rate)
>         self.source.set_gain(gain)
>         self.source.set_center_freq(0)
>
>         self.queue = gr.msg_queue()
>         self.sink = blocks.message_sink(gr.sizeof_short*2, self.queue,
> False)  #This line throws the error
>         self.connect(self.source, self.sink)
> ===================================================
>
> Thanks in advance!
>
> Ting Wu
>
>

No comments:

Post a Comment