missionpinball / mpf-monitor

Graphical utilty which connects to MPF to let you visually control, troubleshoot, and see the status of the machine
http://missionpinball.org
MIT License
11 stars 10 forks source link

Crash with Python 3.11, is PyQt6 compatible with 3.11? #41

Closed toomanybrians closed 9 months ago

toomanybrians commented 9 months ago

I just updated the dev branch to v0.57.0.devXX and added Python 3.10 and 3.11 to the project as supported versions (and tests via GitHub).

Running on my Mac on Python 3.11 alongside MPF 0.57, I get crashes in MPF Monitor like this:

Traceback (most recent call last):
  File "/Users/brian/git/mpf-monitor/mpfmonitor/core/playfield.py", line 326, in mousePressEvent
    self.send_to_inspector_window()
  File "/Users/brian/git/mpf-monitor/mpfmonitor/core/playfield.py", line 396, in send_to_inspector_window
    self.mpfmon.inspector_window_last_selected_cb(pf_widget=self)
  File "/Users/brian/git/mpf-monitor/mpfmonitor/core/inspector.py", line 101, in update_last_selected
    self.ui.size_slider.setValue(self.last_pf_widget.size * 100)
TypeError: setValue(self, a0: int): argument 1 has unexpected type 'float'

The lines in question are here.

Obviously a simple fix is to wrap it in int(), but that leads to the next similar error (line 128), which leads to the next... I played with this but then the slider is wonky and doesn't really work. Plus it doesn't really match what the comments say.

So, I'm not sure what's happening. Searching the web, I can't even figure out if Python 3.11 is actually supported by PyQt6? So, dunno, someone needs to look into this I guess.

In the meantime, if I run on Python 3.9, even with the latest PyQt6 version 6.5.2, it works fine. So I think it's a Python 3.11 thing. (I didn't try on 3.10.)

People can still run this with MPF 0.57. If MPF is on Python 3.11 then they'll just need to have a separate install of 3.9 (again, or maybe 3.10?) to run monitor.

I'm not going to investigate this further at the moment, but if someone wants to take a look, that would be great.

toomanybrians commented 9 months ago

Hmm.. this page seems to show compatibility with Python 3.11:

https://wiki.qt.io/Qt_for_Python

However this is talking about PySide, which is different than PyQt. (Seems like a differently licensed implementation or something?) Dunno if this helps?