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)

From: Paul Atreides
Sent: Tuesday, September 26, 2023 6:40 PM
To: Elmore's
Cc: discuss-gnuradio@gnu.org
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 <wa4...@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


--
This email has been checked for viruses by AVG antivirus software.
www.avg.com

Reply via email to