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
Self update (win_x86): "ERROR: Unable to remove the old version" #5632
Comments
The bug is introduced in 17fc3dc 🤔 |
For some odd reason, this fixes the issue 😕 diff --git a/yt_dlp/update.py b/yt_dlp/update.py
index ac3e28057..94a000105 100644
--- a/yt_dlp/update.py
+++ b/yt_dlp/update.py
@@ -43,7 +43,7 @@ def _get_variant_and_executable_path():
# Ref: https://en.wikipedia.org/wiki/Uname#Examples
if machine[1:] in ('x86', 'x86_64', 'amd64', 'i386', 'i686'):
machine = '_x86' if platform.architecture()[0][:2] == '32' else ''
- return f'{remove_end(sys.platform, "32")}{machine}_exe', path
+ return f'{sys.platform}{machine}_exe', path
path = os.path.dirname(__file__)
if isinstance(__loader__, zipimporter):
@@ -74,8 +74,8 @@ def current_git_head():
_FILE_SUFFIXES = {
'zip': '',
'py2exe': '_min.exe',
- 'win_exe': '.exe',
- 'win_x86_exe': '_x86.exe',
+ 'win32_exe': '.exe',
+ 'win32_x86_exe': '_x86.exe',
'darwin_exe': '_macos',
'darwin_legacy_exe': '_macos_legacy',
'linux_exe': '_linux', |
I wrote:
... but as it turned out:
... IOW, I had 50-50 chances to spot the culprit: One other thing I only noticed today is the way the executable whereas v i.e. Thanks for the fix 👍 , eventually it'll hit the |
Most unfortunately, I can't verify the original issue as fixed 😞 😭 ; not, at least, inside the "dev" STR: https://github.com/ytdl-patched/yt-dlp/releases/tag/2023.01.01.1919 That release was built on code ytdl-patched@b394e67, parent commit being: If one updates that "release" to the latest available (2023.01.02.40298 at the time of writing), original issue persists: [debug] Command-line config: ['--ffmpeg-location', '..', '-vU']
[debug] Encodings: locale cp1253, fs utf-8, pref cp1253, out utf-8 (No VT), error utf-8 (No VT), screen utf-8 (No VT)
[debug] ytdl-patched/yt-dlp version 2023.01.01.1919 [b394e67] (win32_x86_exe)
[debug] ** This build is unofficial daily builds, provided for ease of use.
[debug] ** Please do not ask for any support.
[debug] Plugins: ['Youtube_AgeGateBypassIE']
[debug] Python 3.7.9 (CPython x86 32bit) - Windows-Vista-6.0.6003-SP2 (OpenSSL 1.1.1g 21 Apr 2020)
[debug] exe versions: ffmpeg 5.0 (fdk,setts), ffprobe 5.0, phantomjs 2.1.1, rtmpdump 2.4
[debug] Optional libraries: Cryptodome-3.16.0, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {}
[debug] Loaded 1752 extractors
[debug] Fetching release info: https://api.github.com/repos/ytdl-patched/yt-dlp/releases/latest
Latest version: 2023.01.02.40298, Current version: 2023.01.01.1919
[debug] Downloading _update_spec from https://github.com/ytdl-patched/yt-dlp/releases/download/2023.01.02.40298/_update_spec
Current Build Hash 5c64588d128bd2a90f588867bfda4bf38fe0827d846c1a897485ba325d1e2555
Updating to version 2023.01.02.40298 ...
[debug] Downloading yt-dlp_x86.exe from https://github.com/ytdl-patched/yt-dlp/releases/download/2023.01.02.40298/yt-dlp_x86.exe
[debug] Downloading SHA2-256SUMS from https://github.com/ytdl-patched/yt-dlp/releases/download/2023.01.02.40298/SHA2-256SUMS
ERROR: Unable to remove the old version
Traceback (most recent call last):
File "yt_dlp\update.py", line 272, in update
PermissionError: [WinError 5] Access is denied: 'D:\\Vangelis\\Installers\\youtube-dl\\yt-dlp\\yt-dlp_x86.exe.old'
Updated yt-dlp to version 2023.01.02.40298 Any additional help will be highly welcome! 😉 Kind regards, Happy New Year 😄 ! |
The x64 version is fixed. Since I don't have an x86 system, debugging this is gonna be a pain |
i just wanted to update yt-dlp.exe 2022.11.11 to 2023.01.02 on windows 7 and i got the same error. i'm not using any developer or beta builds, i'm only using update releases yt-dlp itsself finds and downloads. i'm using the standalone .exe for windows 7, which has python included. i'm using 64bit version of yt-dlp standalone. to check if i am using 64bit or 32bit exe i downloaded both binaries (yt-dlp.exe and yt-dlp_x86.exe) and compared file size between my today updated yt-dlp.exe and newly downloaded yt-dlp.exe and yt-dlp_x86.
since i'm using x64 version, and i got that error today after updating from 2022.11.11 to 2023.01.02, i don't think x64 version is fixed. :D |
When updating from old version to current, the updater running is that of the old one. So the fix will only be effective in next release |
diff --git a/yt_dlp/update.py b/yt_dlp/update.py
index a3a731aef..c38bf1ef1 100644
--- a/yt_dlp/update.py
+++ b/yt_dlp/update.py
@@ -264,7 +264,7 @@ def update(self):
self._report_error('Unable to overwrite current version')
return os.rename(old_filename, self.filename)
- if detect_variant() in ('win32_exe', 'py2exe'):
+ if detect_variant() in ('win32_exe', 'win32_x86_exe', 'py2exe'):
atexit.register(Popen, f'ping 127.0.0.1 -n 5 -w 1000 & del /F "{old_filename}"',
shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
elif old_filename: Since it explicitly checked |
FWIW, file
(the log is two days old, when I got access to sister's Win7 SP1 x64 laptop 😉 ...) |
I can confirm the issue is fixed when updating from v2023.01.07.19419 ("daily" update channel) to latest "daily" build 32-bit (v2023.01.08.1919 as of this writing):
... with |
DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE
Checklist
Provide a description that is worded well enough to be understood
My older (but still worthy) laptop is still on a 32-bit Windows OS, thus the variant of
yt-dlp
that I use isyt-dlp_x86.exe
(built on CPython 3.7).Adjacent to the executable, I've placed batch file
update_yt-dlp.cmd
, whose content reads:Running that file while being on the release/stable channel of
yt-dlp
would update it as expected, e.g. from tag2022.10.04
to (latest)2022.11.11
:During the update process, the "old/current" executable is being renamed to
yt-dlp_x86.exe.old
and once the "new/updated" executable has been fully downloaded, the former is then deleted by the updating process (that much detail is not displayed inside the verbose log) ...Let's now move on to the "dev" channel (aka "daily builds") of
yt-dlp
, which offers builds compiled from themaster
branch (many thanks Lesmiscore 😄 ):https://github.com/ytdl-patched/yt-dlp/tags
Due to a number of consecutive
Rebase on Upstream
workflow run failures,https://github.com/ytdl-patched/yt-dlp/actions,
tag 2022.11.14.334 is identical code-wise with tag 2022.11.09.810, see
ytdl-patched@1bf17ad
i.e. 2022.11.14.334 is built from below
yt-dlp
code snapshot:[extractor/stripchat] Improve error message (yt-dlp#5475)
Running the aforementioned batch file on
yt-dlp_x86.exe
version2022.11.14.334
, will update it to the latest release (at the time of writing, that would be2022.11.23.43044
) in a normal/expected fashion:However, when the version to be updated is newer than v
2022.11.14.334
, this is where the new bug manifests itself; e.g., tag 2022.11.15.40298 (first BAD), see ytdl-patched@b9e88f3, is built from belowyt-dlp
code snapshot:[extractor/youtube] Consider language in format de-duplication ;
running my batch file on that version will produce the verbose log that follows:
... the end result being that
yt-dlp
does get updated to the latest available version, but previous renamed version, fileyt-dlp_x86.exe.old
, remains on disk undeleted 😞 ...This isn't a deal-breaker after all, I can still delete that file manually via Windows Explorer, but isn't anymore the planned/expected behaviour...
From a brief dissection,
ytdl-patched/yt-dlp@3b87f4d...a4894d3
my bet is on
[cleanup] Misc
as being the culprit, because it was the most recent commit to "touch" file
yt-dlp/update.py
...Thanks for your attention 😄 , keep up improving
yt-dlp
👍 !Provide verbose output that clearly demonstrates the problem
yt-dlp -vU <your command line>
)[debug] Command-line config
) and insert it belowComplete Verbose Output
The text was updated successfully, but these errors were encountered: