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: unable to rename file" in a Dropbox folder #18078

Closed
shaicoleman opened this issue Nov 5, 2018 · 1 comment
Closed

"ERROR: unable to rename file" in a Dropbox folder #18078

shaicoleman opened this issue Nov 5, 2018 · 1 comment
Labels

Comments

@shaicoleman
Copy link

@shaicoleman shaicoleman commented Nov 5, 2018

If the current directory is a Dropbox synced folder, and the title contains unicode characters, the download will fail with "ERROR: unable to rename file: [Errno 2] No such file or directory"

$ cd ~/Dropbox/myfolder
$ youtube-dl --verbose 'https://www.youtube.com/watch?v=cXRByrzCNOM'
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--verbose', 'https://www.youtube.com/watch?v=cXRByrzCNOM']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2018.11.03
[debug] Python version 3.6.6 (CPython) - Linux-4.15.0-38-generic-x86_64-with-Ubuntu-18.04-bionic
[debug] exe versions: ffmpeg 3.4.4-0ubuntu0.18.04.1, ffprobe 3.4.4-0ubuntu0.18.04.1
[debug] Proxy map: {}
[youtube] cXRByrzCNOM: Downloading webpage
[youtube] cXRByrzCNOM: Downloading video info webpage
[youtube] {18} signature length 42.43, html5 player vflKOteNp [SNIPPED REPEATING LINE]
[debug] Default format spec: bestvideo+bestaudio/best
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[debug] Invoking downloader on 'https://r5---sn-q0cedn7s.googlevideo.com/videoplayback?key=yt6&c=WEB&ei=TTXgW72UEozeVo2KhJAK&clen=5585913&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278&source=youtube&expire=1541441965&ipbits=0&lmt=1502037969877319&gir=yes&mime=video%2Fmp4&requiressl=yes&keepalive=yes&fvip=5&id=o-AM-qMSaGVDuy100t6XJZ49ri8O2X17K-lNVeEh-FjOON&sparams=aitags%2Cclen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Crequiressl%2Csource%2Cexpire&itag=137&ms=au%2Conr&initcwndbps=1457500&mv=m&dur=274.524&mt=1541420255&pl=17&mn=sn-q0cedn7s%2Csn-aigzrn7d&ip=80.111.206.167&mm=31%2C26&signature=952B8169166467215F77D437A50D02C1E3ED3C81.3DB00B639FCE6DB1297569D953B3228DB5D8EB87&ratebypass=yes'
[download] Destination: Trio Lubião - Pássaro Preto (Forró Stream)-cXRByrzCNOM.f137.mp4
[download] 100.0% of 5.33MiB at  6.65MiB/s ETA 00:00ERROR: unable to rename file: [Errno 2] No such file or directory: 'Trio Lubião - Pássaro Preto (Forró Stream)-cXRByrzCNOM.f137.mp4.part' -> 'Trio Lubião - Pássaro Preto (Forró Stream)-cXRByrzCNOM.f137.mp4'
Traceback (most recent call last):
  File "/home/shai/.local/lib/python3.6/site-packages/youtube_dl/downloader/common.py", line 200, in try_rename
    os.rename(encodeFilename(old_filename), encodeFilename(new_filename))
FileNotFoundError: [Errno 2] No such file or directory: 'Trio Lubião - Pássaro Preto (Forró Stream)-cXRByrzCNOM.f137.mp4.part' -> 'Trio Lubião - Pássaro Preto (Forró Stream)-cXRByrzCNOM.f137.mp4'

After running the youtube-dl command a second time, a filename containing "Unicode Encoding Conflict" appears in the Dropbox folder, which might give a hint on what's causing the issue:

$ youtube-dl --verbose 'https://www.youtube.com/watch?v=cXRByrzCNOM'
$ youtube-dl --verbose 'https://www.youtube.com/watch?v=cXRByrzCNOM'
$ ls
'Trio Lubião - Pássaro Preto (Forró Stream)-cXRByrzCNOM.f137.mp4.part'
'Trio Lubião - Pássaro Preto (Forró Stream)-cXRByrzCNOM.f137.mp4 (Unicode Encoding Conflict).part'

Possible way to fix this issue is to create the temporary files inside the tmp folder instead of the current directory.
Another workaround is to use --restrict-filenames
Might also be some bug with Dropbox

System information:

youtube-dl: 2018.11.03
OS: Ubuntu 18.04 x64
Python: 3.6.6
Filesystem: ext4
ffmpeg: 3.4.4 (from the bionic repo)
kernel: 4.15.0 (linux-generic from the bionic repo)
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Nov 5, 2018

Blame Dropbox for that. What you can do is not to write in Dropbox folder or use --restrict-filenames. Writing in temp is not an option since it's not a temp file in the first place.

@dstftw dstftw closed this Nov 5, 2018
@dstftw dstftw added the external-bugs label Nov 5, 2018
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
2 participants
You can’t perform that action at this time.