Spotify-downloader: PermissionError: The process cannot access the file because it is being used by another process

Created on 8 Jan 2021  ยท  3Comments  ยท  Source: spotDL/spotify-downloader

When downloading playlist, following error is thrown:
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\music\Czech songs\.\Temp\DIVOKEJ BILL - Takovej pocit.webm'

Environment

  • System OS: Windows 10

  • Python Version: 3.9.1

  • Install Source: installled with pip install spotdl

  • Version OR Commit hash: Version: 3.2.1


Expected Behaviour

Download full playlist

Actual Behaviour

at 22% PermissionError is thrown

Steps to Reproduce

  1. spotdl https://open.spotify.com/playlist/70ANdI7a9xTCTICgpvOkL8?si=tKVcAPRET3O1Z0sqU5AAfg
  2. wait until 22%

Traceback

File "c:\users\michal\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\michal\appdata\local\programs\python\python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Michal\AppData\Local\Programs\Python\Python39\Scripts\spotdl.exe\__main__.py", line 7, in <module>
  File "c:\users\michal\appdata\local\programs\python\python39\lib\site-packages\spotdl\__main__.py", line 112, in console_entry_point
    downloader.download_multiple_songs(songObjList)
  File "c:\users\michal\appdata\local\programs\python\python39\lib\site-packages\spotdl\download\downloader.py", line 93, in download_multiple_songs
    self._download_asynchronously(songObjList)
  File "c:\users\michal\appdata\local\programs\python\python39\lib\site-packages\spotdl\download\downloader.py", line 355, in _download_asynchronously
    self.loop.run_until_complete(asyncio.gather(*tasks))
  File "c:\users\michal\appdata\local\programs\python\python39\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
  File "c:\users\michal\appdata\local\programs\python\python39\lib\site-packages\spotdl\download\downloader.py", line 350, in _pool_download
    return await self.download_song(song_obj)
  File "c:\users\michal\appdata\local\programs\python\python39\lib\site-packages\spotdl\download\downloader.py", line 300, in download_song
    remove(downloadedFilePath)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\music\\Czech songs\\.\\Temp\\DIVOKEJ BILL - Takovej pocit.webm'

Any other information:

bug

Most helpful comment

I had this issue too, thankfully running the command again seemed to finish downloading the remaining ones

Everything is exactly the same on my PC as @michalfalat except my version of spotDL is 3.3.1 and the playlist I am downloading is different

 97%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Š   |ETA: 00:43, 0.05min/songTraceback (most recent call last):
  File "c:\python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
 97%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Š   |ETA: 00:58, 0.07min/song  File "c:\python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Python39\Scripts\spotdl.exe\__main__.py", line 7, in <module>
  File "c:\python39\lib\site-packages\spotdl\__main__.py", line 112, in console_entry_point
    downloader.download_multiple_songs(songObjList)
  File "c:\python39\lib\site-packages\spotdl\download\downloader.py", line 91, in download_multiple_songs
    self._download_asynchronously(songObjList)
  File "c:\python39\lib\site-packages\spotdl\download\downloader.py", line 355, in _download_asynchronously
    self.loop.run_until_complete(asyncio.gather(*tasks))
  File "c:\python39\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
  File "c:\python39\lib\site-packages\spotdl\download\downloader.py", line 350, in _pool_download
    return await self.download_song(song_obj)
  File "c:\python39\lib\site-packages\spotdl\download\downloader.py", line 258, in download_song
    downloadedFilePath.unlink()
  File "c:\python39\lib\pathlib.py", line 1343, in unlink
    self._accessor.unlink(self)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\XXX\\Downloads\\spotdl\\Temp\\XXX - XXX.mp4'

All 3 comments

I cannot reproduce this error. The playlist downloads correctly for me and does not fail.
Windows 10 Pro, Python 3.9.0, spotDL v3.2.1

I concur, playlist downloads correctly.

I had this issue too, thankfully running the command again seemed to finish downloading the remaining ones

Everything is exactly the same on my PC as @michalfalat except my version of spotDL is 3.3.1 and the playlist I am downloading is different

 97%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Š   |ETA: 00:43, 0.05min/songTraceback (most recent call last):
  File "c:\python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
 97%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–Š   |ETA: 00:58, 0.07min/song  File "c:\python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Python39\Scripts\spotdl.exe\__main__.py", line 7, in <module>
  File "c:\python39\lib\site-packages\spotdl\__main__.py", line 112, in console_entry_point
    downloader.download_multiple_songs(songObjList)
  File "c:\python39\lib\site-packages\spotdl\download\downloader.py", line 91, in download_multiple_songs
    self._download_asynchronously(songObjList)
  File "c:\python39\lib\site-packages\spotdl\download\downloader.py", line 355, in _download_asynchronously
    self.loop.run_until_complete(asyncio.gather(*tasks))
  File "c:\python39\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
  File "c:\python39\lib\site-packages\spotdl\download\downloader.py", line 350, in _pool_download
    return await self.download_song(song_obj)
  File "c:\python39\lib\site-packages\spotdl\download\downloader.py", line 258, in download_song
    downloadedFilePath.unlink()
  File "c:\python39\lib\pathlib.py", line 1343, in unlink
    self._accessor.unlink(self)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\XXX\\Downloads\\spotdl\\Temp\\XXX - XXX.mp4'
Was this page helpful?
0 / 5 - 0 ratings

Related issues

RowanSkie picture RowanSkie  ยท  5Comments

iki picture iki  ยท  4Comments

ritiek picture ritiek  ยท  5Comments

EsmailELBoBDev2 picture EsmailELBoBDev2  ยท  5Comments

b-rad15 picture b-rad15  ยท  4Comments