ERROR: unable to download video data: [Errno 13] Permission denied:

See original GitHub issue

Checklist

  • I’m reporting a broken site support issue
  • I’ve verified that I’m running yt-dlp version 2021.07.07
  • I’ve checked that all provided URLs are alive and playable in a browser
  • I’ve checked that all URLs and arguments with special characters are properly quoted or escaped
  • I’ve searched the bugtracker for similar bug reports including closed ones
  • I’ve read bugs section in FAQ

Verbose log

[debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252
[debug] yt-dlp version 2021.07.07 (exe)
[debug] Python version 3.9.6 (CPython 64bit) - Windows-10-10.0.19043-SP0
[debug] exe versions: ffmpeg 4.3.1-2020-11-19-full_build-www.gyan.dev, ffprobe 4.3.1-2020-11-19-full_build-www.gyan.dev
[debug] Proxy map: {}
[debug] [generic] Extracting URL: _Link Redacted_
[generic] master: Requesting header
WARNING: [generic] Falling back on generic information extractor.
[generic] master: Downloading webpage
[generic] master: Downloading m3u8 information
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, vcodec:vp9.2(10), acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[debug] Downloading subtitles: de, he, fr, es, en, ru, yi

Description

when using native downloader a lot of times it fails with error “ERROR: unable to download video data: [Errno 13] Permission denied:” but if i retry it works, how do i make it retry automatically ? i tried --retries infinite but its not retrying

(i didnt checkbox latest version 2021.07.07 because i am using version built today but also fails on latest “stable”)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:22 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
kenorbcommented, Dec 30, 2021
$ yt-dlp -vci -R5 -f mp4,webm --write-description --write-info-json --all-subs --write-thumbnail --add-metadata https://www.youtube.com/c/DecimalZ/videos
...
[youtube:tab] UCpzhzlCa-QgORPIkddepgSg page 1: Downloading API JSON
[info] Writing playlist metadata as JSON to: Decimal Z - Videos [UCpzhzlCa-QgORPIkddepgSg].info.json
ERROR: Cannot write playlist metadata to JSON file Decimal Z - Videos [UCpzhzlCa-QgORPIkddepgSg].info.json
Traceback (most recent call last):
  File "/snap/yt-dlp/1/lib/python3.8/site-packages/yt_dlp/YoutubeDL.py", line 3591, in _write_info_json
    write_json_file(self.sanitize_info(ie_result, self.params.get('clean_infojson', True)), infofn)
  File "/snap/yt-dlp/1/lib/python3.8/site-packages/yt_dlp/utils.py", line 1842, in write_json_file
    tf = tempfile.NamedTemporaryFile(**compat_kwargs(args))
  File "/usr/lib/python3.8/tempfile.py", line 679, in NamedTemporaryFile
    (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
  File "/usr/lib/python3.8/tempfile.py", line 389, in _mkstemp_inner
    fd = _os.open(file, flags, 0o600)
PermissionError: [Errno 13] Permission denied: 'Decimal Z - Videos [UCpzhzlCa-QgORPIkddepgSg].info.json.y1jfkxmi.tmp'

The command fails each time, also during each regular download (without any parameters).

Maybe snap version of yt-dlp doesn’t have access to the temporary directory? Or it’s using the wrong path?

$ mount | grep dlp
/var/lib/snapd/snaps/yt-dlp_1.snap on /snap/yt-dlp/1 type squashfs (ro,nodev,relatime,x-gdu.hide)
nsfs on /run/snapd/ns/yt-dlp.mnt type nsfs (rw)

Workaround

I’ve removed the snap version and installed manually and it works fine.

0reactions
ehoogeveen-medwebcommented, Dec 30, 2021

If it fails consistently then the retry logic from #2066 wouldn’t help - this issue is about intermittent failures in open.

Having said that, #2066 only covers uses of sanitize_open; write_json_file doesn’t have the retry logic. I think there are a few other paths that don’t have any retry logic (e.g. downloading livechat).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting "[Errno 13] Permission denied" on some videos. - Reddit
"[Errno 13] Permission denied" indicates a problem with the file on your system. In general, this is usually something like trying to create...
Read more >
unable to open for writing: [Errno 13] Permission denied ...
Getting the error message in the title when trying to download videos. Here's the full text using the -v option. [debug] System config:...
Read more >
yt-dlp Permission denied error - Ask Ubuntu
Use the -P option of yt-dlp to specify a path to write the files into, and make sure the current user has write...
Read more >
Errno 13 Permission denied - www-data unable to download ...
Now it seems the data download fine, but I still get all errors from the "Traceback" downwards. The file that I'm trying to...
Read more >
PermissionError: [Errno 13] Permission denied - Stack Overflow
This happens if you are trying to open a file, but your path is a folder. This can happen easily by mistake. To...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found