Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid continuation byte error when try to start with yt command #1271

Open
denozavr opened this issue Apr 15, 2024 · 0 comments
Open

Invalid continuation byte error when try to start with yt command #1271

denozavr opened this issue Apr 15, 2024 · 0 comments

Comments

@denozavr
Copy link

denozavr commented Apr 15, 2024

Sorry if I bother you with useless stuff, but I encountered strange behavior and wanted to clarify it and maybe help others in the future. I did not find similar issues in the repository, so I created this one.

I tried to start yt, search and download the song in 1 command by using the next command yt /Mozart ,da 1,exit > /dev/null 2>&1 & from here: #1252

It did not download a song, so I closed the console, but next time I tried to start yt I got the next error:

  File "C:\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Python39\Scripts\yt.exe\__main__.py", line 7, in <module>
  File "C:\Python39\lib\site-packages\mps_youtube\main.py", line 118, in main
    init.init()
  File "C:\Python39\lib\site-packages\mps_youtube\init.py", line 70, in init
    _init_readline()
  File "C:\Python39\lib\site-packages\mps_youtube\init.py", line 217, in _init_readline
    readline.read_history_file(g.READLINE_FILE)
  File "C:\Python39\lib\site-packages\pyreadline3\rlmain.py", line 176, in read_history_file
    self.mode._history.read_history_file(filename)
  File "C:\Python39\lib\site-packages\pyreadline3\lineeditor\history.py", line 87, in read_history_fi
    for line in open(filename, 'r', encoding='utf-8'):
  File "C:\Python39\lib\codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 445: invalid continuation byte

I tried to update/uninstall/install pip several times, deleted all pip packages and install them again and installed last version of yewtube using the approach from repository (pip install git+https://github.com/mps-youtube/yewtube.git) and restarted computer and nothing helped.

Finally, I studied the error and similar cases on Stack Overflow and the stack trace of the error, and I replaced encoding in open(filename, 'r', encoding='utf-8'): with open(filename, 'r', encoding='ISO-8859-1'): for the C:\Users\myuser\.local\pipx\venvs\yewtube\lib\site-packages\pyreadline3\lineeditor\history.py file. I do this based on the link from Stack Overflow. It helps, but I still wonder what caused this error?

After I fixed the error with manually changing the encoding below the result of yt --version

yewtube version    : 2.10.5
yt_dlp version     : 2024.04.09
Python version     : 3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)]
Processor          : Intel64 Family 6 Model 94 Stepping 3, GenuineIntel
Machine type       : AMD64
Architecture       : 64bit, WindowsPE
Platform           : Windows-10-10.0.19041-SP0
sys.stdout.enc     : utf-8
default enc        : utf-8
Config dir         : C:\Users\myuser\AppData\Roaming\mps-youtube
dbus               : None
glib               : False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant