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

sys.stdout set to None prevents ffmpeg download #71

Open
dioraman opened this issue Jul 8, 2020 · 1 comment
Open

sys.stdout set to None prevents ffmpeg download #71

dioraman opened this issue Jul 8, 2020 · 1 comment

Comments

@dioraman
Copy link

dioraman commented Jul 8, 2020

Hi all!

TL;DR
sys.stdout set to None prevents ffmpeg download and causes a lot of troubles, e.g. here #3 #8 #13 #17 #23 #40 #49 #62 #66 .

Longform
This line (later referred as THE line):

smd/youtube.py

Line 15 in dba1b59

with contextlib.redirect_stdout(None):

sets sys.stdout to None, raising conflicts with moviepy/imageio.
imageio indeed uses stdout for the downloading progress. Indeed, an AttributeError is raised here:
https://github.com/imageio/imageio/blob/23cdcf5e62aceb1a32ee37e529eb731612b98298/imageio/core/fetching.py#L168
as follows (imageio/core/util.py, line 407, in _start):
AttributeError: 'NoneType' object has no attribute 'write'

User cannot read the error since this:
https://github.com/imageio/imageio/blob/23cdcf5e62aceb1a32ee37e529eb731612b98298/imageio/core/fetching.py#L176
always assumes an IOError as suggested here:
https://github.com/imageio/imageio/blob/23cdcf5e62aceb1a32ee37e529eb731612b98298/imageio/core/fetching.py#L184
. In the end, user is misled as shown in .

How to fix it
As far as I understand, the only purpose of THE line is to prevent intro pygame information to be printed in the stdout. If so, changing the environment variable 'PYGAME_HIDE_SUPPORT_PROMPT' to "hide" might be enough.

dioraman added a commit to dioraman/smd that referenced this issue Jul 8, 2020
fix sys.stdout set to None prevents ffmpeg download artyshko#71
@voidoak
Copy link

voidoak commented Jun 27, 2021

I was about to post this very issue, after debugging and crawling backwards through the codebase for about an hour or two. It'll have been a year in two weeks from now since this issue was posted, yet no fix. Seems to be a well built project, yet they've ignored this. I'm on debian 10, buster, and I wonder if this has just not been a common issue for others. I've corrected it in my local version. I doubt we'll see any updates to the original repo as it's been a good two years since the last commit (disregarding the README commit). Hope they fix this, seems like a lot of people have tried and failed to use this due to the error.

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

2 participants