jessedp / pihole5-list-tool

A tool for quickly and easily bulk adding allow and ad/block lists to a Pi-hole 5 installation
MIT License
312 stars 18 forks source link

Issue with python3.10 - Maybe a dependecy issue rather than a pihole5-list-tool issue #37

Closed LukeAllinson closed 1 year ago

LukeAllinson commented 1 year ago

Hello

I noticed that the script stopped working recently and I have traced this back to an update in python version.

Traceback (most recent call last): File "/usr/local/bin/pihole5-list-tool", line 5, in from ph5lt import main File "/usr/local/lib/python3.10/dist-packages/ph5lt.py", line 34, in import prompts File "/usr/local/lib/python3.10/dist-packages/prompts.py", line 4, in from PyInquirer import prompt, Validator, ValidationError, Separator File "/usr/local/lib/python3.10/dist-packages/PyInquirer/init.py", line 6, in from prompt_toolkit.token import Token File "/usr/local/lib/python3.10/dist-packages/prompt_toolkit/init.py", line 16, in from .interface import CommandLineInterface File "/usr/local/lib/python3.10/dist-packages/prompt_toolkit/interface.py", line 19, in from .application import Application, AbortAction File "/usr/local/lib/python3.10/dist-packages/prompt_toolkit/application.py", line 8, in from .key_binding.bindings.basic import load_basic_bindings File "/usr/local/lib/python3.10/dist-packages/prompt_toolkit/key_binding/bindings/basic.py", line 9, in from prompt_toolkit.renderer import HeightIsUnknownError File "/usr/local/lib/python3.10/dist-packages/prompt_toolkit/renderer.py", line 11, in from prompt_toolkit.styles import Style File "/usr/local/lib/python3.10/dist-packages/prompt_toolkit/styles/init.py", line 8, in from .from_dict import * File "/usr/local/lib/python3.10/dist-packages/prompt_toolkit/styles/from_dict.py", line 9, in from collections import Mapping ImportError: cannot import name 'Mapping' from 'collections' (/usr/lib/python3.10/collections/init.py)

I am not a python expert, however from a bit of research it looks like Python3.10 has removed a deprecated feature to do with Collections: https://docs.python.org/3.9/library/collections.html#module-collections

Deprecated since version 3.3, will be removed in version 3.10: Moved Collections Abstract Base Classes to the collections.abc module. For backwards compatibility, they continue to be visible in this module through Python 3.9.

I fixed the issue by the editing the named _fromdict.py file and replacing:

from collections import Mapping with from collections.abc import Mapping

Again, I'm not an expert with Python, so I don't know if this is something that you can fix or if it is an issue with a dependency, however this may prove useful to someone else if they have the same issue.

This is a super useful tool, so thanks for creating it. Many Thanks

jessedp commented 1 year ago

This is fixed in 0.6.1 which is up on pypi

You can update with: sudo pip3 install pihole5-list-tool --upgrade

LukeAllinson commented 1 year ago

ok great; thanks very much.