Error when using PyQt 5.12 on Python 3.10
Pepijn Kenter
titusjan at gmail.com
Sat Feb 12 15:41:52 GMT 2022
Dear PyQt experts.
I am trying to run my PyQt program with Python 3.10 and PyQt 5.12. I am using PyQt 5.12 because this is the most recent version available on Anaconda, unfortunately.
I get an error when I try to take the bitwise-or of two ItemFlags. The following test program demonstrates this.
import sys
from PyQt5.QtCore import Qt
from PyQt5.QtCore import QT_VERSION_STR
from PyQt5.Qt import PYQT_VERSION_STR
print("Python version: {}".format(sys.version))
print("Qt version: {}".format(QT_VERSION_STR))
print("PyQt version: {}".format(PYQT_VERSION_STR))
print()
a = Qt.NoItemFlags | Qt.ItemIsEnabled
b = Qt.ItemIsTristate | Qt.ItemIsUserCheckable
print(a|b)
It gives the following exception.
Traceback (most recent call last):
File "/Users/kenter/prog/py/argos/development/int_coercion.py", line 20, in <module>
print(a|b)
TypeError: unsupported operand type(s) for |: 'ItemFlags' and 'ItemFlags'
When I run it with Python 3.9 and PyQt 5.12 it works fine. It also works fine when I run it with Python 3.10 and PyQt 5.15. This suggests that something was deprecated in Python 3.10 and this was corrected for in PyQt somewhere between versions 5.12 and 5.15.
I get different errors that seem to indicate the same, al related to implicit conversion to integers.
Can you please give some insight here? Is it possible to run PyQt 5.12 with Python 3.10 at all?
Best regards, Pepijn Kenter.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20220212/8142e7c9/attachment.htm>
More information about the PyQt
mailing list