Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Submitted by a____ @ freenode:
ValueError: write to closed file in youtube_dl/youtube_dl/downloader/http.py, line 159, "stream.write(data_block)"This error is raised when downloading a playlist and outputting to stdout.
Command line:
youtube-dl -o '-' <playlist-url>Cause:
It looks like this error is caused by an unconditional close in http.py line 196. The close works fine for normal files because they are only opened once, but causes the error for sys.stdout because it is reused and can't be reopened.
Sort-of visualization:
Proposed fix:
Add a check whether stream is sys.stdout/sys.stdout.buffer.
Diff of proposed fix: