woefe / ytcc

Command line tool to keep track of your favorite playlists on YouTube and many other places.
GNU General Public License v3.0
178 stars 20 forks source link

bug in v2.4.1: 'ytcc tui' throws error "unknown encoding: locale" #99

Closed mdelissen closed 2 years ago

mdelissen commented 2 years ago

When executing ytcc tui the following error is thrown:

...
  File "/usr/local/lib/python3.9/dist-packages/ytcc/config.py", line 217, in _get_config
    with path.open("w", encoding="locale") as conf_file:
  File "/usr/lib/python3.9/pathlib.py", line 1242, in open
    return io.open(self, mode, buffering, encoding, errors, newline,
LookupError: unknown encoding: locale

It was introduced by commit 7052276bd02d927bd0078055b7bfcd81602ba5c4 in file config.py line 217.

I'm new to this project, therefore I don't know which encoding would be the correct one. I hope this helps nevertheless.

Cheers

woefe commented 2 years ago

I think I probably misread https://www.python.org/dev/peps/pep-0597/ then.

What's the output of the locale command on your system? And is ytcc bug-report showing any useful output? And what is the output of python --version?

mdelissen commented 2 years ago

Thanks for the link. As stated there, this feature is available in python >= 3.10. I have installed 3.9.4. The last official stable version is afaik 3.9.7 (Aug. 30, 2021). Haven't tested it with that version.

If you still need the other information, please let me know :)

woefe commented 2 years ago

Should be fixed in 60deef6. Could you test the latest master? The crash is only triggered if ytcc does not find a config file. So make sure that you don't have a config file in any of following locations before you test:

mdelissen commented 2 years ago

Tested and it's working like a charm. Thank you for the fix!