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

DownloadError: ERROR: unable to rename file #2085

Closed
Elite opened this issue Jan 4, 2014 · 2 comments
Closed

DownloadError: ERROR: unable to rename file #2085

Elite opened this issue Jan 4, 2014 · 2 comments

Comments

@Elite
Copy link

@Elite Elite commented Jan 4, 2014

Error's out the below when importing from python script in Windows -

>>> ================================ RESTART ================================
>>> 
C:\Users\kk\Desktop\%(stitle)s-%(id)s.%(ext)s
ERROR:root:ERROR: unable to rename file
Traceback (most recent call last):
  File "C:\Users\kk\Desktop\ytdl_cli\main.py", line 63, in run
    ydl.download([self.url])
  File "C:\Users\kk\Desktop\ytdl_cli\youtube_dl\YoutubeDL.py", line 805, in download
    self.extract_info(url)
  File "C:\Users\kk\Desktop\ytdl_cli\youtube_dl\YoutubeDL.py", line 443, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "C:\Users\kk\Desktop\ytdl_cli\youtube_dl\YoutubeDL.py", line 530, in process_ie_result
    for r in ie_result['entries']
  File "C:\Users\kk\Desktop\ytdl_cli\youtube_dl\YoutubeDL.py", line 468, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "C:\Users\kk\Desktop\ytdl_cli\youtube_dl\YoutubeDL.py", line 563, in process_video_result
    self.process_info(info_dict)
  File "C:\Users\kk\Desktop\ytdl_cli\youtube_dl\YoutubeDL.py", line 776, in process_info
    success = self.fd._do_download(filename, info_dict)
  File "C:\Users\kk\Desktop\ytdl_cli\youtube_dl\FileDownloader.py", line 648, in _do_download
    self.try_rename(tmpfilename, filename)
  File "C:\Users\kk\Desktop\ytdl_cli\youtube_dl\FileDownloader.py", line 180, in try_rename
    self.report_error(u'unable to rename file')
  File "C:\Users\kk\Desktop\ytdl_cli\youtube_dl\FileDownloader.py", line 147, in report_error
    self.ydl.report_error(*args, **kargs)
  File "C:\Users\kk\Desktop\ytdl_cli\youtube_dl\YoutubeDL.py", line 313, in report_error
    self.trouble(error_message, tb)
  File "C:\Users\kk\Desktop\ytdl_cli\youtube_dl\YoutubeDL.py", line 288, in trouble
    raise DownloadError(message, exc_info)
youtube_dl.utils.DownloadError: ERROR: unable to rename file

Code for invocation -

#Get Save Path
        directory = os.path.join(os.path.expanduser('~'), 'Desktop')
        print(os.path.join(directory, '%(title)s-%(id)s.%(ext)s'))
        ydl_options = {
            'outtmpl': os.path.join(directory, '%(title)s-%(id)s.%(ext)s'),
            'logger': logging,
        }
@ghost
Copy link

@ghost ghost commented Jan 4, 2014

Add 'nooverwrites': True to ydl_options

@Elite
Copy link
Author

@Elite Elite commented Jan 4, 2014

Used -

ydl_options = {
            'outtmpl': os.path.join(directory, '%(title)s-%(id)s.%(ext)s'),
            'logger': logging,
            'nooverwrites': True,
        }

Still same error after downloading the file.

Sorry, my mistake. There were two places with options and correcting the right one fixed this. Thanks

@Elite Elite closed this Jan 4, 2014
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.