FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[Bug]: TypeError: int() argument must be a string, a bytes-like object or a number, not 'KeyboardModifier' · Issue #24155 · matplotlib/matplotlib · GitHub

Repository navigation

[Bug]: TypeError: int() argument must be a string, a bytes-like object or a number, not 'KeyboardModifier' #24155

Closed

Description

Bug summary

Error while importing matplotlib qt backend.

The version details are as below
matplotlib: 3.6.1
pyside: 6.4.0
python: 3.9.9

on a macOS-M1 machine.

Code for reproduction

from matplotlib.backends.backend_qtagg import NavigationToolbar2QT as NavigationToolbar

Actual outcome

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'

Expected outcome

No error!

Additional information

No response

Operating system

OS/X

Matplotlib Version

3.6.1

Matplotlib Backend

MacOSX

Python version

3.9.9

Jupyter version

No response

Installation

pip

Activity

  1. tacaswell commented on Oct 13, 2022

    Member

    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.

  2. added this to the v3.6.2 milestone on Oct 13, 2022
  3. added
    🌱 Good first issueOpen a pull request against these issues if there are no active ones!
    Difficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issues
    on Oct 13, 2022
  4. larsoner commented on Oct 13, 2022

    Contributor
  5. abey79 commented on Oct 14, 2022

    This is most likely related to the Enum change, see here.

  6. Marroh commented on Aug 10, 2023

    I resolved the issue by downgrading PySide6 to a version earlier than 6.4.0.👌

  7. 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'
    
  8. rcomer commented on Apr 29, 2024

    Member

    @ReubenVandezande please upgrade your Matplotlib to version 3.6.2 or higher.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty: Mediumhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issuesGUI: Qt🌱 Good first issueOpen a pull request against these issues if there are no active ones!

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL