Closed AleksFimin closed 2 years ago
Sounds like a bug (either in yt-dlp or in your code). Provide a minimum reproducible example and it's verbose log
Sounds like a bug (either in yt-dlp or in your code). Provide a minimum reproducible example and it's verbose log
[debug] Encodings: locale cp1251, fs utf-8, pref cp1251, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version 2022.06.29 [9d339c4]
[debug] Python 3.9.13 (CPython 64bit) - Windows-10-10.0.19044-SP0
[debug] Checking exe version: "./api/ffmpeg" -bsfs
[debug] Checking exe version: "./api/ffprobe" -bsfs
[debug] exe versions: ffmpeg n5.0.1-5-g240d82f26e-20220614 (setts), ffprobe n5.0.1-5-g240d82f26e-20220614
[debug] Optional libraries: Cryptodome-3.15.0, brotli-1.0.9, certifi-2022.06.15, mutagen-1.45.1, sqlite3-2.6.0, websockets-10.3
[debug] Proxy map: {}
[debug] [youtube] Extracting URL: https://www.youtube.com/watch?v=1D5cxbDbKMc
[youtube] 1D5cxbDbKMc: Downloading webpage
[youtube] 1D5cxbDbKMc: Downloading android player API JSON
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source, codec:vp9.2, lang, proto
[debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, hdr:12(7), source, vcodec:vp9.2(10), acodec, lang, proto, filesize, fs_approx, tbr, vbr, abr, asr, vext, aext, hasaud, id
[info] 1D5cxbDbKMc: Downloading 1 format(s): 140
[debug] Invoking http downloader on "https://rr6---sn-01oxu-u5nd.googlevideo.com/videoplayback?expire=1657498832&ei=cBjLYsTTIMWF0u8P3_GdwAk&ip=213.230.80.218&id=o-AHvpD2_x4HZ9Jph80QNG-3gs_gv_NeiTGoURGNk3DlUv&itag=140&source=youtube&requiressl=yes&mh=wU&mm=31%2C29&mn=sn-01oxu-u5nd%2Csn-n8v7kn7z&ms=au%2Crdu&mv=m&mvi=6&pl=23&initcwndbps=402500&vprv=1&mime=audio%2Fmp4&gir=yes&clen=179601207&dur=11097.489&lmt=1641719888326317&mt=1657476784&fvip=5&keepalive=yes&fexp=24001373%2C24007246&c=ANDROID&txp=4531432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRQIgGOdQJ8dPxe_eSm7f6gvcTeiZsxc-zFhz_m3rB6pc7psCIQCGfbCBKWPX5CvDMn1HOnDXrRKnuWj0dg8HI6_2EhgI_g%3D%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhAMu7NrDuXnx6J9ymIlQoqNP82n062QqDTwkDSmcuuXb1AiBJ1105HR_sPHYEg0t0IhtuWuKrDxgwbZdOtBvZUyuMvA%3D%3D"
[download] Resuming download at byte 68598612
[debug] File locking is not supported. Proceeding without locking
[download] Destination: temp\audios\Top 50 Most Popular Songs by NCS _ No Copyright.m4a
[download] 38.8% of 171.28MiB at 135.12KiB/s ETA 13:14[info] The download was cancelled
In progress_hooks I raise a DownloadCancelled exception after which I try to delete the .part file and get an error that the file is occupied by another program
I don't see the example code, only logs
I don't see the example code, only logs
import os, yt_dlp
def progress_bar(data):
if video not in db:
# This is a db check. If video not in the database, I raise an exception
raise DownloadCancelled
print(data.get('_percent_str'))
video_title = 'Egzod & Maestro Chives - Royalty'
yt_dlp.YoutubeDl(options) as yt:
yt.download(url, progress_hooks=[progress_bar])
try:
os.remove(video_title + '.mp4.part')
except OSError as e:
print(e)
This is a simplified version, since the original is linked to the db, but the logic is the same
The example is totally wrong!
But I was able to figure out what you are asking
The example is totally wrong!
I apologize that it is not a 100% finished sample. I didn't think you would run it, so I wrote it for show
But I was able to figure out what you are asking
Thank you. Most importantly, is this a bug?
Yes, yt-dlp isnt closing the file handle. Will fix asap
Yes, yt-dlp isnt closing the file handle. Will fix asap
Understood, and where can I keep track of the fixes?
It's done
It's done
I updated the library, but the error did not disappear.
Either wait for next release, or update to master branch
Thank you so much for your promptness. Everything is running excellent.
Checklist
Please make sure the question is worded well enough to be understood
I run a python file that downloads videos from YouTube. When I call DownloadCancelled, yt-dlp in progress_hooks it stops downloading, but won't let me remove the .part file from disk until I close the python script. Is there any way to delete a .part file without stopping the python script? (For example close the yt-dlp instance or something like that
Provide verbose output that clearly demonstrates the problem
yt-dlp -vU <your command line>
)[debug] Command-line config
) and insert it belowComplete Verbose Output
No response