mps-youtube / yewtube

yewtube, forked from mps-youtube , is a Terminal based YouTube player and downloader. No Youtube API key required.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error on playing any song

opened this issue · comments

Issue

When launching a song I get this error :

`/usr/lib/python3.9/subprocess.py:937: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
  self.stdout = io.open(c2pread, 'rb', bufsize)`

I already applied patch for other bug like in #1128 and in #1086 and have a personal API key.

Environment

My mpsyt --version output:

mpsyt version      : 0.2.8
   notes           : released 17 February 2018
pafy version       : 0.5.5 (youtube-dl backend)
youtube-dl version : 2021.02.10
Python version     : 3.9.1 (default, Feb  6 2021, 06:49:13)
[GCC 10.2.0]
Processor          :
Machine type       : x86_64
Architecture       : 64bit, ELF
Platform           : Linux-5.10.16-arch1-1-x86_64-with-glibc2.33
sys.stdout.enc     : utf-8
default enc        : utf-8
Config dir         : /home/laura/.config/mps-youtube
env:TERM           : screen
env:SHELL          : /bin/bash
env:LANG           : fr_FR.UTF8

As the bug doesn't prevent me from using the application (the functions I use are not broken) mpsy is usable, but I don't know if it can be annoying on a longer term or for others.

It seems the issue came from some changes to Python (Source: https://bugs.python.org/issue32236). What I did was downgrade to Python 3.7.9 first, reinstall mps-youtube and its dependencies, and the issue went away. It was replaced by this issue though (#1113). Fortunately, the fix was also discussed there, which is essentially downgrading from MPV v0.32 to MPV v0.31. After doing these steps, mps-youtube was now working. I don't know if the Python downgrade had any to do with the second issue I encountered, but I put it out here just in case you run into the same issues that I did. Hope this helps.

Can't we just remove the buffering attribute ? As said in the source you've sended :
«In binary mode, setting buffering to 1 is silently ignored and equivalent to using default buffer size.» in the previous versions. The only difference is that now it throw a warning. If we let the default value (removing buffering=1) it should work as usually.

Confirmed by changing the two instances of "bufsize=1" in player.py to "bufsize=0" as a quick hack that the error goes away and songs play through to the end instead of getting cut off too soon.

It effectively works for me.

Maybe gonna do a pull request, since it seems that a lot of people have this issue.