Skip to content

Conversation

@J4NS-R
Copy link

@J4NS-R J4NS-R commented Nov 11, 2022

This resolves an import error in the collections library when using python 3.10 or higher.

ImportError: cannot import name 'Mapping' from 'collections' (/opt/homebrew/Cellar/python@3.10/3.10.6_2/Frameworks/Python.framework/Versions/3.10/lib/python3.10/collections/__init__.py) 
@cdelahanty
Copy link

Love the 3.10 migration work! Forced the update to prompt_toolkit=3.0.32 on my machine and it introduces an import error. More work would need to resolve that:
image

bkus added a commit to HamWAN/packer-routeros that referenced this pull request Jan 21, 2023
There's a fix for the PyInquirer breakage: CITGuru/PyInquirer#194 But PyInquirer doesn't have a maintainer anymore: CITGuru/PyInquirer#159 The sudo bundle update is because some gems have native extensions, and those don't get installed or recognized properly by the subsequent rake build.
@S4nd3sh
Copy link

S4nd3sh commented Jul 27, 2023

I know the PyPi is not up to date and forces users to install older prompt-toolkit.

The workaround for me that worked is to install from the latest commit. It did pull the prompt-toolkit 3.x.xx and didn't raise any errors when loading it.
'pyInquirer @ git+https://github.com/CITGuru/PyInquirer.git#7637373429bec66788650cda8091b7a6f12929ee'

The change I made in the code moving from PyPi install is change the import of prompt from PyInquirer,
from PyInquirer import prompt change to from PyInquirer.prompt import prompt

@kubow
Copy link

kubow commented Aug 14, 2024

And what about to do:

try: from collections.abc import Mapping except ImportError: from collections import Mapping

to keep that backwards compatible?

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

Labels

None yet

4 participants