The lesson here is that you should check the default encoding on your system (using python3 -c 'import locale; print(locale.getpreferred-encoding())') to understand how it differs from your expectations.
should be:
The lesson here is that you should check the default encoding on your system (using python3 -c 'import locale; print(locale.getpreferredencoding())') to understand how it differs from your expectations.
As written:
kjells:notebooks$ python3 -c 'import locale; print(locale.getpreferred-encoding())'
Traceback (most recent call last):
File "", line 1, in
AttributeError: module 'locale' has no attribute 'getpreferred'
With change:
kjells:notebooks$ python3 -c 'import locale; print(locale.getpreferredencoding())'
UTF-8
kjells:notebooks$ python3 --version
Python 3.12.3