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

--download-archive doesn't create directories when needed #8395

Open
bool3max opened this issue Feb 1, 2016 · 1 comment
Open

--download-archive doesn't create directories when needed #8395

bool3max opened this issue Feb 1, 2016 · 1 comment
Labels
bug

Comments

@bool3max
Copy link

@bool3max bool3max commented Feb 1, 2016

So, I'm on Linux and this is the exact command I'm executing:

sudo youtube-dl https://www.youtube.com/playlist?list=PLjlvXrjuRczngya2R6iQpUx8UnSCG7DAo --extract-audio --audio-format mp3 --playlist-start 1 -o playlist_storage/PLjlvXrjuRczngya2R6iQpUx8UnSCG7DAo/%\(title\)s.%\(ext\)s --download-archive playlist_storage/PLjlvXrjuRczngya2R6iQpUx8UnSCG7DAo/PLjlvXrjuRczngya2R6iQpUx8UnSCG7DAo.txt

And I get this error:

    Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/bin/youtube-dl/__main__.py", line 19, in <module>
  File "/usr/local/bin/youtube-dl/youtube_dl/__init__.py", line 411, in main
  File "/usr/local/bin/youtube-dl/youtube_dl/__init__.py", line 401, in _real_main
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1690, in download
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 677, in extract_info
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 830, in process_ie_result
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 623, in _match_entry
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1768, in in_download_archive
  File "/usr/local/bin/youtube-dl/youtube_dl/utils.py", line 1231, in __init__
IOError: [Errno 20] Not a directory: 'playlist_storage/PLjlvXrjuRczngya2R6iQpUx8UnSCG7DAo/PLjlvXrjuRczngya2R6iQpUx8UnSCG7DAo.txt'

What's causing this?

@jaimeMF jaimeMF changed the title IOError: [Errno 20] Not a directory ? --download-archive doesn't create directories when needed Feb 2, 2016
@jaimeMF jaimeMF added the bug label Feb 2, 2016
@FlintTD
Copy link

@FlintTD FlintTD commented Mar 23, 2016

I've been working on your bug issue. The IOError error exception is being thrown by io.open, a python library function used for wrapping streams. For whatever reason, the program is passing a text file to __init__ when it expects a directory location, although the text file appears to hold a textual file location.

After some tracing of the error readout and the program structure, I have come to the conclusion that one of the videos in the playlist is being flagged as age-restricted. When this happens, the program goes out to check in_download_archive(), packages the video download request as an "archive file", and tries to open the "archive file":

try with locked_file(fn, 'r', encoding = 'utf-8') as archive_file:

When the class description of locked_file(object) is invoked (in utils.py), io.open is called:

self.f = io.open(filename, mode, encoding = encoding)

"filename" is actually passed to the locked_file class initializer as "fn" in the try with line above. As it turns out, "fn" is actually the text file being passed to io.open which io.open expects to be a directory address. "fn" is created in in_download_archive():

fn = self.params.get('download_archive')

According to the YoutubeDL class header:

download_archive:  File name of a file where all downloads are recorded.
                       Videos already present in the file are not downloaded
                       again.

To me, it looks like the program is having some trouble passing data around, and it may have converted a directory link into text format for ease of passing, and failed to convert it back. I could be very wrong, since I did this analysis a few weeks ago and hadn't had the time to post it until now. I hope that a more official developer on the project sees this bump and responds. If you, boskia12, are still having this problem, please reply with any other information you have, like if any videos are downloaded or files are created before the program fails. If you can't re-create the problem with the latest youtube-dl build, please close the bug report since that would imply the devs fixed the problem.

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
3 participants
You can’t perform that action at this time.