xmikos / qspectrumanalyzer

Spectrum analyzer for multiple SDR platforms (PyQtGraph based GUI for soapy_power, hackrf_sweep, rtl_power, rx_power and other backends)
GNU General Public License v3.0
1.21k stars 246 forks source link

HackRF One TypeError Unexpected Type #101

Open ThreeCalories opened 2 years ago

ThreeCalories commented 2 years ago

When I attempt to run hackrf_sweep I get a TypeError unexpected 'float' type.

QSocketNotifier: Can only be used with threads started with QThread
Traceback (most recent call last):
  File "/home/threecalories/.local/lib/python3.10/site-packages/qspectrumanalyzer/__main__.py", line 368, in on_startButton_clicked
    self.start()
  File "/home/threecalories/.local/lib/python3.10/site-packages/qspectrumanalyzer/__main__.py", line 303, in start
    self.progressbar.setRange(0, self.intervalSpinBox.value() * 1000)
TypeError: setRange(self, int, int): argument 2 has unexpected type 'float'

Any help resolving this would be much appreciated.

courtarro commented 1 year ago

Not the developer, but this looks related to issues in how Python 3.10 handles float and int types. The literal 1000 is obviously an int, but even though self.intervalSpinBox.value() should always be an int, maybe Python is returning a float for that? Otherwise I guess the workaround is to wrap int:

int(self.intervalSpinBox.value() * 1000)

Or if you have Python 3.9 give that a shot. See also.