davidfoerster/aptsources-cleanup

Python 3.11 removes the `codeset` parameter from `gettext.translation`

Opened this issue · 3 comments

When executing the aptsources-cleanup it gets the below traceback errors:

Traceback (most recent call last):
  File "/home/poya/Downloads/cleanup/aptsources-cleanup-0.1.7.5.2/./aptsources-cleanup", line 9, in <module>
    runpy.run_module('aptsources_cleanup', run_name='__main__')
  File "<frozen runpy>", line 229, in run_module
  File "<frozen runpy>", line 88, in _run_code
  File "/home/poya/Downloads/cleanup/aptsources-cleanup-0.1.7.5.2/src/aptsources_cleanup/__main__.py", line 386, in <module>
    rv = main()
         ^^^^^^
  File "/home/poya/Downloads/cleanup/aptsources-cleanup-0.1.7.5.2/src/aptsources_cleanup/__main__.py", line 35, in main
    args = parse_args(args)
           ^^^^^^^^^^^^^^^^
  File "/home/poya/Downloads/cleanup/aptsources-cleanup-0.1.7.5.2/src/aptsources_cleanup/__main__.py", line 199, in parse_args
    translations.add_fallback(
  File "/home/poya/Downloads/cleanup/aptsources-cleanup-0.1.7.5.2/src/aptsources_cleanup/util/functools.py", line 144, in <lambda>
    return lambda *args: getter(self._get_instance())(*args)
                                ^^^^^^^^^^^^^^^^^^^^
  File "/home/poya/Downloads/cleanup/aptsources-cleanup-0.1.7.5.2/src/aptsources_cleanup/util/functools.py", line 98, in _get_instance
    self._li_instance = self._li_factory()
                        ^^^^^^^^^^^^^^^^^^
  File "/home/poya/Downloads/cleanup/aptsources-cleanup-0.1.7.5.2/src/aptsources_cleanup/util/gettext.py", line 137, in _make_translations
    translations = translation('messages', get_localedir(), fallback=True)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/poya/Downloads/cleanup/aptsources-cleanup-0.1.7.5.2/src/aptsources_cleanup/util/gettext.py", line 99, in translation
    return _gettext.translation(
           ^^^^^^^^^^^^^^^^^^^^^
TypeError: translation() takes from 1 to 5 positional arguments but 6 were given

I see that Python 3.11 removed the codeset parameter from gettext.translation. Luckily, we don’t use that anywhere, so I’ll simply remove it. I’ll push that in a moment.

Do you know how to use Git? Could you please try out #39? (see Usage: from source if you don’t know how)

bro, install with

wget https://github.com/davidfoerster/aptsources-cleanup/releases/download/v0.1.7.5.2/aptsources-cleanup.pyz

at I work