GRC QT GUI Range with slider presents error

Using GNU Radio Companion 3.9.4.0.

My application has a "QT GUI Range" block. When the Widget is set to "Counter + Slider" I get the error

TypeError: setRange(self, int, int): argument 2 has unexpected type 'float'

The Python code for this condition is,

self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, "RF Gain", "counter_slider", float, QtCore.Qt.Horizontal)

With the Widget set to "Counter" there is no error. Now that same Python line is,

self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, "RF Gain", "counter", float, QtCore.Qt.Horizontal)

How can I use the desired slider?

= = =

The full error message is:

File "C:\Users\User1\Documents\Records\Software Defined Radio - SDR\GNU Radio\Flowgraphs\HackADay Tutorials\Video 02\Simple_AM_Rx_01_temp.py", line 100, in __init__
    self._rf_gain_win = RangeWidget(self._rf_gain_range, self.set_rf_gain, "RF Gain", "counter_slider", float, QtCore.Qt.Horizontal)
  File "C:\Users\User1\miniforge3\envs\gnuradio\lib\site-packages\gnuradio\qtgui\range.py", line 121, in __init__
    self.d_widget = self.CounterSlider(self, self.range, self.notifyChanged, rangeType, orientation)
  File "C:\Users\User1\miniforge3\envs\gnuradio\lib\site-packages\gnuradio\qtgui\range.py", line 262, in __init__
    self.slider = RangeWidget.Slider(parent, ranges, self.sliderChanged, rangeType, orientation)
  File "C:\Users\User1\miniforge3\envs\gnuradio\lib\site-packages\gnuradio\qtgui\range.py", line 161, in __init__
    self.setRange(0, ranges.nsteps - 1)
TypeError: setRange(self, int, int): argument 2 has unexpected type 'float'

1 answer

  • answered 2021-11-23 02:28 Passerby

    Your traceback shows that the file C:\Users\User1\miniforge3\envs\gnuradio\lib\site-packages\gnuradio\qtgui\range.py has this line:

    self.setRange(0, ranges.nsteps - 1)
    

    but when I check the repository for this project here I see

    self.setRange(0, int(ranges.nsteps - 1))
    

    They corrected a bug. You are using an outdated version of the project.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum