Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected type ’float’ with Python 3.10 #361

Closed
mdinslage opened this issue Oct 10, 2021 · 2 comments
Closed

Unexpected type ’float’ with Python 3.10 #361

mdinslage opened this issue Oct 10, 2021 · 2 comments
Labels
bug Faults with Polychromatic itself controller Specific to the main application

Comments

@mdinslage
Copy link

Distro: Slackware 15 RC1

Version: Openrazer 3.1.0

Version: Polychromatic 0.7.0

Today Slackware upgraded its Python3 to version 3.10. After rebuilding openrazer and all the required dependencies for both it and polychromatic I am getting the following error

Eeks! An uncaught exception was thrown while loading the tab.

Traceback (most recent call last):
  File ’/usr/share/polychromatic/../../bin/polychromatic-controller’, line 380, in _change_tab
    tab_objects[index].set_tab()
  File ’/usr/lib64/python3.10/site-packages/polychromatic/controller/devices.py’, line 136, in set_tab
    self.open_device(first_item.backend, first_item.uid)
  File ’/usr/lib64/python3.10/site-packages/polychromatic/controller/devices.py’, line 244, in open_device
    widgets.append(self._create_row_control(device, zone, option))
  File ’/usr/lib64/python3.10/site-packages/polychromatic/controller/devices.py’, line 311, in _create_row_control
    return self.widgets.create_row_widget(option_label, self._create_control_slider(device, zone, option))
  File ’/usr/lib64/python3.10/site-packages/polychromatic/controller/devices.py’, line 342, in _create_control_slider
    slider.setTickInterval(option[’max’] / 10)
TypeError: setTickInterval(self, int): argument 1 has unexpected type ’float’

Polychromatic does launch, but is mostly unusable to to this error. I am assuming this is somehow related to Python 3.10 since it broke right after Slackware added it. I have been rebuilding many packages because of it.

If anyone has any ideas please let me know.
Thanks

@mdinslage mdinslage added the bug Faults with Polychromatic itself label Oct 10, 2021
@lah7 lah7 added dependencies A library or dependency affecting Polychromatic and removed dependencies A library or dependency affecting Polychromatic labels Oct 10, 2021
@lah7
Copy link
Member

lah7 commented Oct 10, 2021

I can confirm it's an issue with our code, sorry! I haven't seen this deprecation notice until now, after testing PyQt5 code in a Python 3.9 interpreter:

DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using int is deprecated, and may be removed in a future version of Python.

The temporary fix would be to make amends to /usr/lib64/python3.10/site-packages/polychromatic/controller/devices.py on line 342.

-slider.setTickInterval(option["max"] / 10)
+slider.setTickInterval(int(option["max"] / 10))

This is a bit awkward since I have a huge refactor in progress, and this bug will affect other rolling release distros soon, so I'll need to act swiftly.

@lah7 lah7 changed the title Possible issue with Python 3.10 Unexpected type ’float’ with Python 3.10 Oct 10, 2021
@mdinslage
Copy link
Author

No apology necessary. Things happen on the bleeding edge. And yes, Slackware is pretty much a rolling release right now, much to the frustration of many Slackware users, myself included. Usually when Slackware hits RC stage a upgrade like Python 3.9 to 3.10 wouldn't happen, but I guess Patrick Volkerding has his reasons. Anyway, the temporary fix above works.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Faults with Polychromatic itself controller Specific to the main application
Projects
None yet
Development

No branches or pull requests

2 participants