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

Error: Cannot write metadata to JSON file. Why is this occurring? #20295

Closed
ghost opened this issue Mar 9, 2019 · 2 comments
Closed

Error: Cannot write metadata to JSON file. Why is this occurring? #20295

ghost opened this issue Mar 9, 2019 · 2 comments

Comments

@ghost
Copy link

@ghost ghost commented Mar 9, 2019

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like this: [x])
  • Use the Preview tab to see what your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2019.03.09. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

  • [x ] I've verified and I assure that I'm running youtube-dl 2019.03.09

Before submitting an issue make sure you have:

  • [x ] At least skimmed through the README, most notably the FAQ and BUGS sections
  • [ x] Searched the bugtracker for similar issues including closed ones
  • [ x] Checked that provided video/audio/playlist URLs (if any) are alive and playable in a browser

What is the purpose of your issue?

  • [ x] Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • [x ] Question
  • Other

The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue


If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

Add the -v flag to your command line you run youtube-dl with (youtube-dl -v <your command line>), copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):


E:\YouTube-dl Projects\YouTube>youtube-dl -v -o ./Channels/%(channel)s/%(upload_date)s_%(title)s.%(ext)s --batch-file youtube-dl-channels.txt --format ("bestvideo[width>=1920]"/bestvideo)+bestaudio/best --download-archive youtube-dl-archive.txt  --yes-playlist --output %(uploader)s_%(channel_id)s/%(upload_date)s-%(uploader)s/%(playlist_uploader)s-%(playlist_title)s/%(upload_date)s-%(title)s-%(id)s/%(upload_date)s %(title)s %(resolution)s %(id)s.%(ext)s --add-metadata --write-info-json --write-all-thumbnails --embed-subs --all-subs --write-description --write-annotation --merge-output-format mkv
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '-o', './Channels/%(channel)s/%(upload_date)s_%(title)s.%(ext)s', '--batch-file', 'youtube-dl-channels.txt', '--format', '(bestvideo[width>=1920]/bestvideo)+bestaudio/best', '--download-archive', 'youtube-dl-archive.txt', '--yes-playlist', '--output', '%(uploader)s_%(channel_id)s/%(upload_date)s-%(uploader)s/%(playlist_uploader)s-%(playlist_title)s/%(upload_date)s-%(title)s-%(id)s/%(upload_date)s', '%(title)s', '%(resolution)s', '%(id)s.%(ext)s', '--add-metadata', '--write-info-json', '--write-all-thumbnails', '--embed-subs', '--all-subs', '--write-description', '--write-annotation', '--merge-output-format', 'mkv']
[debug] Batch file urls: ['https://www.youtube.com/user/galenmarek49/videos', 'https://www.youtube.com/user/HPGamesru/playlists', 'https://www.youtube.com/user/HPGamesru/videos', 'https://www.youtube.com/channel/UC4Y0v0kalu8sChpvHpKFlaw', 'https://www.youtube.com/channel/UCzHoBd5i16VkC4P44f5acFA', 'https://www.youtube.com/user/UNworld95', 'https://www.youtube.com/user/Fagottron', 'https://www.youtube.com/user/NickBertke/videos', 'https://www.youtube.com/user/SuzanneCiani', 'https://www.youtube.com/channel/UCtwKon9qMt5YLVgQt1tvJKg', 'https://www.youtube.com/watch?v=2qI96lddRn4&list=UU1aPeLTxBgZmiuzkcUZBTIw', 'https://www.youtube.com/user/CloserToTruth1', 'https://www.youtube.com/channel/UCWTFGPpNQ0Ms6afXhaWDiRw', 'https://www.youtube.com/channel/UCCrnCItH17W-64FDzjwOi5w', 'https://www.youtube.com/user/bebopsam1975', 'https://www.youtube.com/user/allinaday', 'https://www.youtube.com/channel/UCTLrhK07g6LP-JtT0VVE56A', 'https://www.youtube.com/channel/UC0wb5NK7yi0O-1Wy_7C8tbw', 'https://www.youtube.com/user/periodicvideos', 'https://www.youtube.com/user/engineerguyvideo', 'https://www.youtube.com/user/seancarroll/', 'https://www.youtube.com/user/damewse', 'https://www.youtube.com/user/Scrunchthethird', 'https://www.youtube.com/user/Fibbs1701', 'https://www.youtube.com/user/melodysheep', 'https://www.youtube.com/user/Techmoan', 'https://www.youtube.com/user/tibees', 'https://www.youtube.com/user/enyay', 'https://www.youtube.com/user/msadaghd', 'https://www.youtube.com/user/ContourCorsets', 'https://www.youtube.com/user/vlogbrothers', 'https://www.youtube.com/user/TVLEGENDS', 'https://www.youtube.com/user/johnnycarson/videos', 'https://www.youtube.com/channel/UCFC8Vt3FY_7svm_SOBK5aIQ']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2019.03.09
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.17763
[debug] exe versions: ffmpeg N-93302-g147ef1d947, ffprobe N-93302-g147ef1d947
[debug] Proxy map: {}
[youtube:user] galenmarek49: Downloading channel page
[youtube:playlist] UUyqDA4dvZA0zSG8OVJ1HRSQ: Downloading webpage
[download] Downloading playlist: Uploads from galenmarek49
[youtube:playlist] playlist Uploads from galenmarek49: Downloading 63 videos
[download] Downloading video 1 of 63
[download] Harry Potter And The Sorcerer's Stone PC Restored/Free Play Setup Tutorial has already been recorded in archive
[download] Downloading video 2 of 63
[download] Harry Potter And The Sorcerer's Stone PC Restored Update has already been recorded in archive
[download] Downloading video 3 of 63
[download] Harry Potter And The Sorcerer's Stone PC Restored Part 19 has already been recorded in archive
[download] Downloading video 4 of 63
[download] Harry Potter And The Sorcerer's Stone PC Restored Part 18 has already been recorded in archive
[download] Downloading video 5 of 63
[download] Harry Potter And The Sorcerer's Stone PC Restored Part 17 has already been recorded in archive
[download] Downloading video 6 of 63
[download] Harry Potter And The Sorcerer's Stone PC Restored Part 16 has already been recorded in archive
[download] Downloading video 7 of 63
[download] Harry Potter And The Sorcerer's Stone PC Restored Part 15 has already been recorded in archive
[download] Downloading video 8 of 63
[download] Harry Potter And The Sorcerer's Stone PC Restored Part 14 has already been recorded in archive
[download] Downloading video 9 of 63
[download] Harry Potter And The Sorcerer's Stone PC Restored Part 13 has already been recorded in archive
[download] Downloading video 10 of 63
[download] Harry Potter And The Sorcerer's Stone PC Restored Part 12 has already been recorded in archive
[download] Downloading video 11 of 63
[download] Harry Potter And The Sorcerer's Stone PC Restored Part 11 has already been recorded in archive
[download] Downloading video 12 of 63
[download] Harry Potter And The Sorcerer's Stone PC Restored Part 10 has already been recorded in archive
[download] Downloading video 13 of 63
[download] Harry Potter And The Sorcerer's Stone PC Restored Part 9 has already been recorded in archive
[download] Downloading video 14 of 63
[download] Harry Potter And The Sorcerer's Stone PC Restored Part 8 has already been recorded in archive
[download] Downloading video 15 of 63
[download] Harry Potter And The Sorcerer's Stone PC Restored Part 7 has already been recorded in archive
[download] Downloading video 16 of 63
[download] Harry Potter And The Sorcerer's Stone PC Restored Part 6 has already been recorded in archive
[download] Downloading video 17 of 63
[download] Harry Potter And The Sorcerer's Stone PC Restored Part 5 has already been recorded in archive
[download] Downloading video 18 of 63
[download] Harry Potter And The Sorcerer's Stone PC Restored Part 4 has already been recorded in archive
[download] Downloading video 19 of 63
[download] Harry Potter and The Sorcerer's Stone PC Restored Part 3 has already been recorded in archive
[download] Downloading video 20 of 63
[download] Harry Potter and The Sorcerer's Stone PC Restored Walkthrough Part 2 has already been recorded in archive
[download] Downloading video 21 of 63
[youtube] ZV2ZVdxRLpI: Downloading webpage
[youtube] ZV2ZVdxRLpI: Downloading video info webpage
WARNING: video doesn't have subtitles
[youtube] ZV2ZVdxRLpI: Searching for annotations.
[youtube] ZV2ZVdxRLpI: Downloading MPD manifest
[info] Writing video description to: galenmarek49_UCyqDA4dvZA0zSG8OVJ1HRSQ\20171027-galenmarek49\galenmarek49-Uploads from galenmarek49\20171027-Harry Potter And The Sorcerer's Stone PC Restored and causeevent Walkthrough Part 1-ZV2ZVdxRLpI\20171027.description
[info] Writing video annotations to: galenmarek49_UCyqDA4dvZA0zSG8OVJ1HRSQ\20171027-galenmarek49\galenmarek49-Uploads from galenmarek49\20171027-Harry Potter And The Sorcerer's Stone PC Restored and causeevent Walkthrough Part 1-ZV2ZVdxRLpI\20171027.annotations.xml
[info] Writing video description metadata as JSON to: galenmarek49_UCyqDA4dvZA0zSG8OVJ1HRSQ\20171027-galenmarek49\galenmarek49-Uploads from galenmarek49\20171027-Harry Potter And The Sorcerer's Stone PC Restored and causeevent Walkthrough Part 1-ZV2ZVdxRLpI\20171027.info.json
ERROR: Cannot write metadata to JSON file galenmarek49_UCyqDA4dvZA0zSG8OVJ1HRSQ\20171027-galenmarek49\galenmarek49-Uploads from galenmarek49\20171027-Harry Potter And The Sorcerer's Stone PC Restored and causeevent Walkthrough Part 1-ZV2ZVdxRLpI\20171027.info.json
Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpy110f8qy\build\youtube_dl\YoutubeDL.py", line 1837, in process_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmpy110f8qy\build\youtube_dl\utils.py", line 238, in write_json_file
  File "C:\Python\Python34\lib\tempfile.py", line 484, in NamedTemporaryFile
  File "C:\Python\Python34\lib\tempfile.py", line 207, in _mkstemp_inner
FileNotFoundError: [Errno 2] No such file or directory: "galenmarek49_UCyqDA4dvZA0zSG8OVJ1HRSQ\\20171027-galenmarek49\\galenmarek49-Uploads from galenmarek49\\20171027-Harry Potter And The Sorcerer's Stone PC Restored and causeevent Walkthrough Part 1-ZV2ZVdxRLpI\\20171027.info.json.w9p_9p0c.tmp"


E:\YouTube-dl Projects\YouTube>PAUSE
Press any key to continue . . .
<end of log>

Description of your issue, suggested solution and other information

Why is this occurring? I've referenced another thread, "ERROR: Cannot write metadata to JSON file" if .json file already exists" It appears this error will display for videos previously downloaded (when the script is run again, after stopping it) and then on videos not downloaded yet/first attempt at downloading.

@ghost
Copy link
Author

@ghost ghost commented Mar 10, 2019

Can anyone assist with this? Thank you!

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Mar 10, 2019

Most likely due to Windows MAX_PATH limitation.
Also your command is incorrect. Don't pass output template twice and quote it properly.

@dstftw dstftw closed this Mar 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.