TypeError in spectrum_settings.py
ratherforky opened this issue · comments
OS: Arch
Python version: 3.10.2
Friture fails at launch for me due to this exception:
File "/home/j/Software/friture/friture/spectrum_settings.py", line 78, in __init__
self.spinBox_minfreq.setMaximum(SAMPLING_RATE / 2)
TypeError: setMaximum(self, int): argument 1 has unexpected type 'float'
More detailed trace
2022-03-10 13:22:13,663 CRITICAL friture.exceptionhandler: Unhandled exception: Traceback (most recent call last):
File "/home/j/Software/friture/buildenv/bin/friture", line 7, in <module>
exec(compile(f.read(), __file__, 'exec'))
File "/home/j/Software/friture/scripts/friture", line 10, in <module>
main()
File "/home/j/Software/friture/friture/analyzer.py", line 395, in main
window = Friture()
File "/home/j/Software/friture/friture/analyzer.py", line 154, in __init__
self.restoreAppState()
File "/home/j/Software/friture/friture/analyzer.py", line 258, in restoreAppState
self.dockmanager.restoreState(settings)
File "/home/j/Software/friture/friture/dockmanager.py", line 84, in restoreState
self.docks = [Dock(self.parent(), "Dock %d" % (i), self.parent().qml_engine, widgetId=widget_type) for i, widget_type in enumerate(DEFAULT_DOCKS)]
File "/home/j/Software/friture/friture/dockmanager.py", line 84, in <listcomp>
self.docks = [Dock(self.parent(), "Dock %d" % (i), self.parent().qml_engine, widgetId=widget_type) for i, widget_type in enumerate(DEFAULT_DOCKS)]
File "/home/j/Software/friture/friture/dock.py", line 58, in __init__
self.widget_select(widgetId)
File "/home/j/Software/friture/friture/dock.py", line 90, in widget_select
self.audiowidget = constructor(self, self.qml_engine)
File "/home/j/Software/friture/friture/spectrum.py", line 89, in __init__
self.settings_dialog = Spectrum_Settings_Dialog(self)
File "/home/j/Software/friture/friture/spectrum_settings.py", line 78, in __init__
self.spinBox_minfreq.setMaximum(SAMPLING_RATE / 2)
TypeError: setMaximum(self, int): argument 1 has unexpected type 'float'
self.spinBox_maxfreq.setMaximum(SAMPLING_RATE / 2)
on line 86 has the same issue. The simple fix is to change SAMPLING_RATE / 2
to SAMPLING_RATE // 2
as has been done in spectrogram_settings.py. With those two changes, friture now launches fine for me. I'll make a pull request for these changes shortly.
Incidentally, I can now launch the unpatched executable installed from the AUR because I removed the FFT spectrum widget, so the buggy code is never ran.
If you can't start friture at all because of this bug, a quick fix is to modify your Friture.conf (stored in $home/.config/Friture/
for me) and change dockNames=[whatever]
to dockNames=@Invalid()
. This will start friture without any docks, bypassing the buggy spectrum code. You can then add whatever docks you like (except the spectrum ofc).
Thank you very much @ratherforky.
The latest 0.49 release contains these changes.