davidfoerster / aptsources-cleanup

Detects and interactively deactivates duplicate Apt source entries and deletes sources list files without valid enabled source entries (as requested in https://askubuntu.com/a/762815/175814).
MIT License
667 stars 85 forks source link

AttributeError: '_sre.SRE_Pattern' object has no attribute 'fullmatch' #14

Closed garland closed 5 years ago

garland commented 5 years ago

Following the instructions provided, running aptsources-cleanup on my system using sudo python -OEs aptsources-cleanup.zip produced the following error:

Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "aptsources-cleanup.zip/__main__.py", line 9, in <module>
File "/usr/lib/python2.7/runpy.py", line 182, in run_module
mod_name, loader, code, fname = _get_module_details(mod_name)
File "/usr/lib/python2.7/runpy.py", line 111, in _get_module_details
__import__(mod_name)  # Do not catch exceptions initializing package
File "aptsources-cleanup.zip/aptsources_cleanup/__init__.py", line 19, in <module>
File "aptsources-cleanup.zip/aptsources_cleanup/util/filesystem.py", line 8, in <module>
File "aptsources-cleanup.zip/aptsources_cleanup/util/gettext.py", line 264, in <module>
self._fallback = fallback
File "aptsources-cleanup.zip/aptsources_cleanup/util/gettext.py", line 393, in Choices
# Unicode using the character encoding specified in the charset
AttributeError: '_sre.SRE_Pattern' object has no attribute 'fullmatch'

locale output:

LANG=en_AU.UTF-8
LANGUAGE=en_AU:en_GB:en
LC_CTYPE=en_AU.UTF-8
LC_NUMERIC=en_AU.UTF-8
LC_TIME=en_AU.UTF-8
LC_COLLATE=en_AU.UTF-8
LC_MONETARY=en_AU.UTF-8
LC_MESSAGES=en_AU.UTF-8
LC_PAPER=en_AU.UTF-8
LC_NAME=en_AU.UTF-8
LC_ADDRESS=en_AU.UTF-8
LC_TELEPHONE=en_AU.UTF-8
LC_MEASUREMENT=en_AU.UTF-8
LC_IDENTIFICATION=en_AU.UTF-8
LC_ALL=
davidfoerster commented 5 years ago

I’ll address the issue in a bit.

It shouldn’t occur with Python 3.4 or later when re.fullmatch() was added. So, if you have access to Python 3, which you do on all supported Ubuntu releases, please use it instead because that’s the main development target:

sudo python3 -OEs aptsources-cleanup.zip

Python 2 support is more of a crutch.

davidfoerster commented 5 years ago

I just dropped support for Python 2 since all Apt distros still supported by their vendors should provide Python 3 anyway.