discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Index Error: output_index < noutputs


From: Jeff Long
Subject: Re: Index Error: output_index < noutputs
Date: Wed, 27 Sep 2023 06:09:14 -0400

In the previous GRC you posted, there is a "Wave Select" Python block with no inputs or outputs. I don't think we have enough info to figure out what you are doing. As Paul Atreides mentioned, posting a full GRC would help.

On Tue, Sep 26, 2023 at 10:36 PM Elmore Family <wa4ywm@comcast.net> wrote:

Paul,

Thanks for answering. The following is what I hope is a simplified presentation of my code that is pertinent to the issue. The top flowgraph is complex. The FT8_Receive hier block is simple. The connections section below should be sufficient for explaining it.

I am using a gnu radio flowgraph to attempt to select the appropriate Selector Block output as explained below. The following error occurs when I run the flowgraph: Index Error: output_index must be < noutputs.

Obviously the chosen index of 1 is less than the number of outputs 2. What is wrong?

The following code is in an FT8_Receive hier block. It shows only the code pertinent to the issue I am experiencing. The connections section shows the Selector Block with 2 outputs connected to 2 Wave File Sinks. I am attempting to select the appropriate output by using wave_select in the output index as shown in def set_wave_select().

 class FT8_Receive(gr.hier_block2):
    def __init__(self, wave_select=0):
        gr.hier_block2.__init__(
            self, "FT8_Receive",
                gr.io_signature(1, 1, gr.sizeof_float*1),
                gr.io_signature(0, 0, 0),
    )

    ##################################################
    # Parameters
    ##################################################
    self.wave_select = wave_select
    
    ##################################################
    # Connections
    ##################################################
    self.connect((self.blocks_selector_0, 1), (self.blocks_wavfile_sink_0_0, 0))
    self.connect((self.blocks_selector_0, 0), (self.blocks_wavfile_sink_0_0_0, 0))
    self.connect((self, 0), (self.rational_resampler_xxx_0, 0))
    self.connect((self.rational_resampler_xxx_0, 0), (self.blocks_selector_0, 0))

.................................

    def get_wave_select(self):
        return self.wave_select

    def set_wave_select(self, wave_select):
        self.wave_select = wave_select
        self.blocks_selector_0.set_output_index(self.wave_select)

The following code is from the .py file that is an OOT in the top block of the flowgraph. This is where I am calling set_wave_select.

from FT8_Receive import FT8_Receive

RCV = FT8_Receive()
wave_select = 1
RCV.set_wave_select(wave_select)
 
Sent: Tuesday, September 26, 2023 6:40 PM
Subject: Re: Index Error: output_index < noutputs
 
Jim, can you please re-post your flowgraph?
I’ll try to take another look at it.
Also, what version of GNURadio are you using?

<end transmission>

On Sep 26, 2023, at 11:48, Elmore's <wa4ywm@comcast.net> wrote:


I have submitted this issue previously and received a response which resulted in my trying several things which didn’t work.
 
I then submitted the issue to Stackoverflow and received no answers.
 
I get this error when I try to use a Selector to select one of 2 outputs with my selection obviously being smaller than the number of outputs. I can successfully use a Selector if I use a number for the output index or a variable whose value is selected by a Toggle Button but not if I try to set the variable programmatically in Python.
 
In general, why do you get such an error?  I am asking the question in this manner because my specific questions relating to my code and flowgraph have not resulted in any concrete answers (or any answers at all).
 
Thanks again for any help. I have been struggling with this for several weeks.
 
Jim

Virus-free.www.avg.com

reply via email to

[Prev in Thread] Current Thread [Next in Thread]