TypeError: translation() got an unexpected keyword argument 'codeset'

53 views
Skip to first unread message

Bjoern Franke

unread,
Jan 28, 2024, 4:07:26 PMJan 28
to py...@googlegroups.com
Hi,

the MicroSD of the Pi2 running pywws for years unfortunately died. So I
reinstalled Archlinux Arm on a new MicroSD and took /var/lib/pywws from
the fortunately existing backups.

But pywws does not start:

Jan 28 20:52:56 fh19 pywws-livelog[1101]: pywws.logger:pywws version
23.2.0, build 1703 (e8dfaba)
Jan 28 20:52:56 fh19 pywws-livelog[1101]: Traceback (most recent call last):
Jan 28 20:52:56 fh19 pywws-livelog[1101]: File
"/usr/bin/pywws-livelog", line 8, in <module>
Jan 28 20:52:56 fh19 pywws-livelog[1101]: sys.exit(main())
Jan 28 20:52:56 fh19 pywws-livelog[1101]: ^^^^^^
Jan 28 20:52:56 fh19 pywws-livelog[1101]: File
"/usr/lib/python3.11/site-packages/pywws/livelog.py", line 130, in main
Jan 28 20:52:56 fh19 pywws-livelog[1101]: return live_log(args[0])
Jan 28 20:52:56 fh19 pywws-livelog[1101]: ^^^^^^^^^^^^^^^^^
Jan 28 20:52:56 fh19 pywws-livelog[1101]: File
"/usr/lib/python3.11/site-packages/pywws/livelog.py", line 73, in live_log
Jan 28 20:52:56 fh19 pywws-livelog[1101]:
pywws.localisation.set_application_language(context.params)
Jan 28 20:52:56 fh19 pywws-livelog[1101]: File
"/usr/lib/python3.11/site-packages/pywws/localisation.py", line 224, in
set_application_language
Jan 28 20:52:56 fh19 pywws-livelog[1101]: set_translation(lang)
Jan 28 20:52:56 fh19 pywws-livelog[1101]: File
"/usr/lib/python3.11/site-packages/pywws/localisation.py", line 200, in
set_translation
Jan 28 20:52:56 fh19 pywws-livelog[1101]: translation =
gettext.translation(
Jan 28 20:52:56 fh19 pywws-livelog[1101]:
^^^^^^^^^^^^^^^^^^^^
Jan 28 20:52:56 fh19 pywws-livelog[1101]: TypeError: translation() got
an unexpected keyword argument 'codeset'

Searching for the error only showed me some django issues which should
be unrelated.

Regards
Bjoern

Jim Easterbrook

unread,
Jan 29, 2024, 3:21:29 AMJan 29
to py...@googlegroups.com
On 28/01/2024 21:00, 'Bjoern Franke' via pywws wrote:
>
> the MicroSD of the Pi2 running pywws for years unfortunately died. So I
> reinstalled Archlinux Arm on a new MicroSD and took /var/lib/pywws from
> the fortunately existing backups.
>
> But pywws does not start:
>
> Jan 28 20:52:56 fh19 pywws-livelog[1101]:   File
> "/usr/lib/python3.11/site-packages/pywws/localisation.py", line 200, in
> set_translation
> Jan 28 20:52:56 fh19 pywws-livelog[1101]:     translation =
> gettext.translation(
> Jan 28 20:52:56 fh19 pywws-livelog[1101]: ^^^^^^^^^^^^^^^^^^^^
> Jan 28 20:52:56 fh19 pywws-livelog[1101]: TypeError: translation() got
> an unexpected keyword argument 'codeset'

The 'codeset' parameter of gettext.translation has been removed in
Python 3.11
https://docs.python.org/3.11/library/gettext.html#class-based-api

Every computer capable of running pywws should be using utf-8 these
days, so it's probably safe to assume codeset is always utf-8, but make
sure all your templates are utf-8 coded.

Edit pywws/localisation.py and change lines 58-59 from

translation = gettext.translation(
'pywws', path, languages=langs, codeset=codeset)


--
Jim Easterbrook <http://www.jim-easterbrook.me.uk/>

Jim Easterbrook

unread,
Jan 29, 2024, 3:23:14 AMJan 29
to py...@googlegroups.com
On 28/01/2024 21:00, 'Bjoern Franke' via pywws wrote:
>
> the MicroSD of the Pi2 running pywws for years unfortunately died. So I
> reinstalled Archlinux Arm on a new MicroSD and took /var/lib/pywws from
> the fortunately existing backups.
>
> But pywws does not start:
>
> Jan 28 20:52:56 fh19 pywws-livelog[1101]:   File
> "/usr/lib/python3.11/site-packages/pywws/localisation.py", line 200, in
> set_translation
> Jan 28 20:52:56 fh19 pywws-livelog[1101]:     translation =
> gettext.translation(
> Jan 28 20:52:56 fh19 pywws-livelog[1101]: ^^^^^^^^^^^^^^^^^^^^
> Jan 28 20:52:56 fh19 pywws-livelog[1101]: TypeError: translation() got
> an unexpected keyword argument 'codeset'

The 'codeset' parameter of gettext.translation has been removed in
Python 3.11
https://docs.python.org/3.11/library/gettext.html#class-based-api

Every computer capable of running pywws should be using utf-8 these
days, so it's probably safe to assume codeset is always utf-8, but make
sure all your templates are utf-8 coded.

Edit pywws/localisation.py and change lines 58-59 from

translation = gettext.translation(
'pywws', path, languages=langs, codeset=codeset)

to

translation = gettext.translation(
'pywws', path, languages=langs)

(Sorry about previous truncated message. Got sent prematurely.)

Bjoern Franke

unread,
Jan 29, 2024, 3:33:46 AMJan 29
to py...@googlegroups.com
Hi,

>
> Edit pywws/localisation.py and change lines 58-59 from
>
> translation = gettext.translation(
> 'pywws', path, languages=langs, codeset=codeset)
>
>

you meant line 200? Lines 58-59 contain some documentation.

And you wrote I should change the lines from the above - but to what? ;)

Best Regards
Bjoern


Bjoern Franke

unread,
Jan 29, 2024, 3:47:38 AMJan 29
to py...@googlegroups.com
Hi,

> 'pywws', path, languages=langs)
>
> (Sorry about previous truncated message. Got sent prematurely.)

Sorry, I didn't saw this mail while replying to the first one.

Jim Easterbrook

unread,
Jan 29, 2024, 3:51:35 AMJan 29
to py...@googlegroups.com
On 29/01/2024 08:33, 'Bjoern Franke' via pywws wrote:
>
>>
>> Edit pywws/localisation.py and change lines 58-59 from
>>
>
> you meant line 200? Lines 58-59 contain some documentation.

Yes. I read the column number instead of the line number on my editor
window. I'm an idiot!

I've just uploaded suitably changed files for this and other recent
changes to GitHub. There will be a new release of pywws this week.
Reply all
Reply to author
Forward
0 new messages