Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compatible with Python 3.10 (cannot import name 'Mapping' from 'collections') #293

Open
wolfgang42 opened this issue Jun 4, 2022 · 3 comments

Comments

@wolfgang42
Copy link

This was apparently a deprecated alias which was removed in Python 3.10; the new way of doing it is collections.abc.

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/pyjade/runtime.py", line 8, in <module>
    from collections import Mapping as MappingType
ImportError: cannot import name 'Mapping' from 'collections' (/usr/local/lib/python3.10/collections/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  [...]
  File "/usr/local/lib/python3.10/site-packages/pyjade/runtime.py", line 10, in <module>
    import UserDict
ModuleNotFoundError: No module named 'UserDict'

Workaround: use Python 3.9 instead.

@Ucag
Copy link

Ucag commented Jun 4, 2022 via email

wolfgang42 added a commit to wolfgang42/ftfyweb that referenced this issue Jun 4, 2022
PyJade isn't compatible with Python 3.10, due to some deprecation removals:
syrusakbary/pyjade#293
@fatsen
Copy link

fatsen commented Jun 21, 2024

Open the folder of pyjade, and open runtime.py, then change from collections import Mapping as MappingType into from collections.abc import Mapping as MappingType. This problem solved, and it works ok for python 3.11.8. I don't know the reason, for i got this solution from my python teacher.

@wolfgang42
Copy link
Author

@fatsen Your (teacher’s) change works because Mapping was moved from collections to collections.abc in Python 3.3.

However, do note that editing the source code of a library in the files that were installed is generally considered a bad idea: it will work on your computer, but is confusing when you come back to the program later when you have forgotten you did that, and is hard to keep track of if you ever give the program to someone else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants