mirage icon indicating copy to clipboard operation
mirage copied to clipboard

Python 3.10: AttributeError: module 'collections' has no attribute 'Mapping'

Open Dejvino opened this issue 3 years ago • 7 comments

Description

After upgrading to Python 3.10, the app fails to load with an exception: AttributeError: module 'collections' has no attribute 'Mapping'

Your environment

  • OS or distribution: Arch Linux
  • Architecture: x86 64bit
  • Desktop environment: sway 1.6.1-2
  • How did you install Mirage? AUR (yay)
  • Python version: 3.10.1

Steps to reproduce

  1. Run mirage

Expected behavior

The app loads without errors.

Actual behavior

Error dialog is shown:

AttributeError: module 'collections' has no attribute 'Mapping'

Traceback (most recent call last):
  File "qrc:/src/backend/matrix_client.py", line 404, in _start
    sync_filter_ids = await self.sync_filter_ids()
  File "qrc:/src/backend/matrix_client.py", line 500, in sync_filter_ids
    utils.dict_update_recursive(first, self.low_limit_filter)
  File "qrc:/src/backend/utils.py", line 73, in dict_update_recursive
    isinstance(dict2[k], collections.Mapping)):
AttributeError: module 'collections' has no attribute 'Mapping'

Notes

Mapping was moved to collections.abc ever since Python 3.3 and now in Python 3.10 it is no longer in collections, hence the error. Until now, there was a deprecation warning printed. Reference: python docs.

Dejvino avatar Dec 15 '21 06:12 Dejvino

I was about to submit a PR but it seems there already is one fixing it nicely: #274 😅 👏

Dejvino avatar Dec 15 '21 06:12 Dejvino

Same

KSPAtlas avatar Dec 18 '21 14:12 KSPAtlas

Installed Mirage on Garuda Linux and am getting the very same error.

Anything I can do about this?

IngwiePhoenix avatar Dec 21 '21 07:12 IngwiePhoenix

Installed Mirage on Garuda Linux and am getting the very same error.

Anything I can do about this?

Use my fork with fix on python3.10-collections branch.

vSLG avatar Dec 24 '21 01:12 vSLG

Just in case someone needs a mini-howto: install the matrix-mirage-git from the AUR and change in the PKGBUILD the line with source in: source=("git://github.com/vSLG/${_name}.git#branch=python3.10-collections")

For it works now perfect ;)

Thorgrimson avatar Dec 24 '21 07:12 Thorgrimson

Where do I find said PKGBUILD file on my system?

I am used to APT, thus not very familiar with the Arch way - yet. :)

IngwiePhoenix avatar Dec 27 '21 08:12 IngwiePhoenix

The Arch way is to read the Wiki as it is awesome and answers nearly every question: https://wiki.archlinux.org/title/Arch_User_Repository#Installing_and_upgrading_packages Your question would not make sense if you would use the official way to build AUR packages and can not be answered if you don't tell us which AUR helper you use? For yay it is in ~/.cache/yay but if you want to modify it better use the standard way described in the wiki.

DrRac27 avatar Dec 27 '21 10:12 DrRac27