[Bug]: TypeError: int() argument must be a string, a bytes-like object or a number, not 'KeyboardModifier' · Issue #24155 · matplotlib/matplotlib · GitHub
Traceback (most recent call last):
File "", line 1, in
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/matplotlib/backends/backend_qtagg.py", line 12, in
from .backend_qt import QtCore, QtGui, _BackendQT, FigureCanvasQT
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/matplotlib/backends/backend_qt.py", line 72, in
_MODIFIER_KEYS = [
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/matplotlib/backends/backend_qt.py", line 73, in
(_to_int(getattr(_enum("QtCore.Qt.KeyboardModifier"), mod)),
TypeError: int() argument must be a string, a bytes-like object or a number, not 'KeyboardModifier'
pyside 6.4.0 went up on pypi about 2 hours ago. I suspect something changed about how the handle enums and we will need to adjust.
This is a good first issue because the behavior is "should import" and the changes should be localized to only backend_qt.py and qt_compat.py, but medium difficulty because it will require understanding what the changes to PySide6 were and how to adapt our shim layers to work with both these changes, the previous behavior of Pyside and PyQt's behavior.
>>> import PySide6
>>> PySide6.__version__
'6.5.3'
>>> import matplotlib
>>> matplotlib.__version__
'3.5.3'
>>> from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".../matplotlib/backends/backend_qt5agg.py", line 7, in <module>
from .backend_qtagg import ( # noqa: F401, E402 # pylint: disable=W0611
File ".../matplotlib/backends/backend_qtagg.py", line 12, in <module>
from .backend_qt import (
File ".../matplotlib/backends/backend_qt.py", line 76, in <module>
for mod, key in [
File ".../matplotlib/backends/backend_qt.py", line 76, in <listcomp>
for mod, key in [
TypeError: int() argument must be a string, a bytes-like object or a number, not 'KeyboardModifier'
Activity
tacaswell commented on Oct 13, 2022
pyside 6.4.0 went up on pypi about 2 hours ago. I suspect something changed about how the handle enums and we will need to adjust.
This is a good first issue because the behavior is "should import" and the changes should be localized to only backend_qt.py and qt_compat.py, but medium difficulty because it will require understanding what the changes to PySide6 were and how to adapt our shim layers to work with both these changes, the previous behavior of Pyside and PyQt's behavior.
larsoner commented on Oct 13, 2022
FYI I expect this to break stuff for a lot of folks. It broke a bunch of our CIs in MNE-Python :(
https://dev.azure.com/mne-tools/mne-python/_build/results?buildId=22361&view=logs&jobId=dded70eb-633c-5c42-e995-a7f8d1f99d91&j=dded70eb-633c-5c42-e995-a7f8d1f99d91&t=1ccededa-7e7e-5a92-87ce-e531d760d025
abey79 commented on Oct 14, 2022
This is most likely related to the Enum change, see here.
Marroh commented on Aug 10, 2023
I resolved the issue by downgrading PySide6 to a version earlier than 6.4.0.👌
ReubenVandezande commented on Apr 29, 2024
Can confirm I also see this:
>>> import PySide6 >>> PySide6.__version__ '6.5.3' >>> import matplotlib >>> matplotlib.__version__ '3.5.3' >>> from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg Traceback (most recent call last): File "<stdin>", line 1, in <module> File ".../matplotlib/backends/backend_qt5agg.py", line 7, in <module> from .backend_qtagg import ( # noqa: F401, E402 # pylint: disable=W0611 File ".../matplotlib/backends/backend_qtagg.py", line 12, in <module> from .backend_qt import ( File ".../matplotlib/backends/backend_qt.py", line 76, in <module> for mod, key in [ File ".../matplotlib/backends/backend_qt.py", line 76, in <listcomp> for mod, key in [ TypeError: int() argument must be a string, a bytes-like object or a number, not 'KeyboardModifier'rcomer commented on Apr 29, 2024
@ReubenVandezande please upgrade your Matplotlib to version 3.6.2 or higher.