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

choicebox not working under Python 3.10.1 #191

Closed
ingski opened this issue Jan 23, 2022 · 4 comments
Closed

choicebox not working under Python 3.10.1 #191

ingski opened this issue Jan 23, 2022 · 4 comments

Comments

@ingski
Copy link

ingski commented Jan 23, 2022

import easygui
easygui.choicebox("Text", choices = ['a', 'b'])

results in Error:

Traceback (most recent call last):
File "./dummy.py", line 2, in
easygui.choicebox("Text", choices = ['a', 'b'])
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/easygui/boxes/choice_box.py", line 38, in choicebox
mb = ChoiceBox(msg, title, choices, preselect=preselect,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/easygui/boxes/choice_box.py", line 123, in init
preselect_list = make_list_or_none(preselect, cast_type=int)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/easygui/boxes/choice_box.py", line 95, in make_list_or_none
if not isinstance(obj, collections.Sequence):
AttributeError: module 'collections' has no attribute 'Sequence'

@BeppeC
Copy link

BeppeC commented Jan 28, 2022

The error is due because staritng from Python 3.7 Sequnce has been moved to collections.abc
I fixed on mine adding in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/easygui/boxes/choice_box.py after import declarations

try:
    collectionsAbc = collections.abc
except AttributeError:
    collectionsAbc = collections

and then replacing in the file collections with collectionsAbc

I don't know if it is the best solution but it worked with me

@ingski
Copy link
Author

ingski commented Jan 30, 2022

I now fixed it by replacing in the file collections with collections.abc

@tirkarthi
Copy link

Seems to have been fixed in a3391a3

@zadacka
Copy link
Collaborator

zadacka commented Apr 28, 2022

Yep, this one should be fixed now. Thank you for reporting it!

@zadacka zadacka closed this as completed Apr 28, 2022
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

4 participants