[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Error when using PyQt 5.12 on Python 3.10
From: Pepijn Kenter <titusjan () gmail ! com>
Date: 2022-02-12 15:41:52
Message-ID: 95F837F9-FDA2-4DF7-8646-E89DBFAD0AD5 () gmail ! com
[Download RAW message or body]
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.
[Attachment #3 (unknown)]
<html><head><meta http-equiv="Content-Type" content="text/html; \
charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: \
space; line-break: after-white-space;" class=""><div class="">Dear PyQt \
experts.</div><div class=""><br class=""></div><div class="">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. </div><div \
class=""><br class=""></div><div class="">I get an error when I try to take the \
bitwise-or of two ItemFlags. The following test program demonstrates this.</div><div \
class=""><br class=""></div><div class=""><span style="font-family: Menlo, monospace; \
background-color: rgb(255, 255, 255); color: rgb(0, 0, 128); font-weight: bold;" \
class="">import </span><span style="font-family: Menlo, monospace; background-color: \
rgb(255, 255, 255);" class="">sys</span></div><div class=""><pre \
style="background-color: rgb(255, 255, 255); font-family: Menlo, monospace;" \
class=""><span style="color:#000080;font-weight:bold;" class="">from \
</span>PyQt5.QtCore <span style="color:#000080;font-weight:bold;" class="">import \
</span>Qt<br class=""><span style="color:#000080;font-weight:bold;" class="">from \
</span>PyQt5.QtCore <span style="color:#000080;font-weight:bold;" class="">import \
</span>QT_VERSION_STR<br class=""><span style="color:#000080;font-weight:bold;" \
class="">from </span>PyQt5.Qt <span style="color:#000080;font-weight:bold;" \
class="">import </span>PYQT_VERSION_STR<br class=""><br class=""><span \
style="color:#000080;" class="">print</span>(<span \
style="color:#008000;font-weight:bold;" class="">"Python version: \
{}"</span>.format(sys.version))<br class=""><span style="color:#000080;" \
class="">print</span>(<span style="color:#008000;font-weight:bold;" class="">"Qt \
version: {}"</span>.format(QT_VERSION_STR))<br class=""><span style="color:#000080;" \
class="">print</span>(<span style="color:#008000;font-weight:bold;" class="">"PyQt \
version: {}"</span>.format(PYQT_VERSION_STR))<br class=""><span \
style="color:#000080;" class="">print</span>()<br class=""><br class="">a = \
Qt.NoItemFlags | Qt.ItemIsEnabled<br class="">b = Qt.ItemIsTristate | \
Qt.ItemIsUserCheckable<br class=""><br class=""><span style="color:#000080;" \
class="">print</span>(a|b)<br class=""><br class=""></pre></div><div class="">It \
gives the following exception.</div><div class=""><br class=""></div><div \
class=""><br class=""></div><div class=""><div class="">Traceback (most recent call \
last):</div><div class=""> File \
"/Users/kenter/prog/py/argos/development/int_coercion.py", line 20, in \
<module></div><div class=""> print(a|b)</div><div \
class="">TypeError: unsupported operand type(s) for |: 'ItemFlags' and \
'ItemFlags'</div></div><div class=""><br class=""></div><div class=""><br \
class=""></div><div class="">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. </div><div class=""><br \
class=""></div><div class="">I get different errors that seem to indicate the same, \
al related to implicit conversion to integers.</div><div class=""><br \
class=""></div><div class="">Can you please give some insight here? Is it possible to \
run PyQt 5.12 with Python 3.10 at all?</div><div class=""><br class=""></div><div \
class="">Best regards, Pepijn Kenter.</div><div class=""><br \
class=""></div></body></html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic