spotDL / spotify-downloader

Download your Spotify playlists and songs along with album art and metadata (from YouTube if a match is found).
https://spotdl.readthedocs.io/en/latest/
MIT License
16.91k stars 1.56k forks source link

Python Stopped Working While Downloading Album #1405

Closed c00ldude69 closed 2 years ago

c00ldude69 commented 2 years ago

System OS

Windows

Python Version

3.9 (CPython)

Install Source

pip / PyPi

Install version / commit hash

v3.8.0

Expected Behavior vs Actual Behavior

So today I was listening to an album by K. and thought of downloading it as I am gonna listen to it multiple times. So I opened command prompt and spotdl [albumURL] --output-format flac --dt 16 Spotdl successfully fetched whole album and downloaded it. But as the 'tagging' process started I saw some glitch and a message popped up on the display: python has stopped working. So I thought of raising an issue so that our lovely developers/contributors can fix the issue. Being a normie, I am not even sure if it's spotdl's issue or python's issue. The album folder kinda looks like this now.

Anyway, I thought I should let you know guys. Love you, bless you. Ya'll are doin' God's work. Peace.

Steps to reproduce

print("I just started learning Python.")

Traceback

Traceback (most recent call last):
  File "d:\program files\python\python-3.9.6\lib\site-packages\spotdl\download\downloader.py", line 238, in download_song
    self.download_tracker.notify_download_completion(song_object)
  File "d:\program files\python\python-3.9.6\lib\site-packages\spotdl\download\tracking_file_handler.py", line 107, in notify_download_completion
    self.backup_to_disk()
  File "d:\program files\python\python-3.9.6\lib\site-packages\spotdl\download\tracking_file_handler.py", line 92, in backup_to_disk
    with open(self.save_file, "wb") as file_handle:
PermissionError: [Errno 13] Permission denied: 'DUCKWORTH..spotdlTrackingFile'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:\program files\python\python-3.9.6\lib\site-packages\spotdl\console\__init__.py", line 91, in console_entry_point
    downloader.download_multiple_songs(song_list)
  File "d:\program files\python\python-3.9.6\lib\site-packages\spotdl\download\downloader.py", line 88, in download_multiple_songs
    self._download_asynchronously(song_list)
  File "d:\program files\python\python-3.9.6\lib\site-packages\spotdl\download\downloader.py", line 111, in _download_asynchronously
    self.loop.run_until_complete(asyncio.gather(*tasks))
  File "d:\program files\python\python-3.9.6\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
  File "d:\program files\python\python-3.9.6\lib\site-packages\spotdl\download\downloader.py", line 120, in _pool_download
    return await self.download_song(song_obj)
  File "d:\program files\python\python-3.9.6\lib\site-packages\spotdl\download\downloader.py", line 247, in download_song
    display_progress_tracker.notify_error(e, tb)
  File "d:\program files\python\python-3.9.6\lib\site-packages\spotdl\download\progress_ui_handler.py", line 272, in notify_error
    self.update(message="Error " + self.status)
  File "d:\program files\python\python-3.9.6\lib\site-packages\spotdl\download\progress_ui_handler.py", line 289, in update
    self.parent._rich_progress_bar.start_task(self.task_id)
  File "d:\program files\python\python-3.9.6\lib\site-packages\rich\progress.py", line 720, in start_task
    task = self._tasks[task_id]
KeyError: 5

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "d:\program files\python\python-3.9.6\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "d:\program files\python\python-3.9.6\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\Program Files\Python\python-3.9.6\Scripts\spotdl.exe\__main__.py", line 7, in <module>
  File "d:\program files\python\python-3.9.6\lib\site-packages\spotdl\console\__init__.py", line 91, in console_entry_point
    downloader.download_multiple_songs(song_list)
  File "d:\program files\python\python-3.9.6\lib\site-packages\spotdl\download\downloader.py", line 56, in __exit__
    shutil.rmtree(temp_folder)
  File "d:\program files\python\python-3.9.6\lib\shutil.py", line 740, in rmtree
    return _rmtree_unsafe(path, onerror)
  File "d:\program files\python\python-3.9.6\lib\shutil.py", line 618, in _rmtree_unsafe
    onerror(os.unlink, fullname, sys.exc_info())
  File "d:\program files\python\python-3.9.6\lib\shutil.py", line 616, in _rmtree_unsafe
    os.unlink(fullname)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'spotdl-temp\\w6tN6_-0Nio.webm'

Other details

No response

Coddo-Python commented 2 years ago

Hi, your steps to reproduce don't look accurate! Can you confirm that this issue can happen again and again (is a reproducible issue) and can you send the EXACT command used (including album URL) here, or you can edit your original message? Sorry for the late response!

Silverarmor commented 2 years ago

Can you attempt it without changing the download threads? (--dt), your computer may not be able to handle it.

mendelsphotography commented 2 years ago

happend to me to what I did was and worked for me go and download python 10

mendelsphotography commented 2 years ago

after i did that no more issue so that's what i say to do the meanwhile

Silverarmor commented 2 years ago

spotDL does not support Python 3.10 due to wheel issues, on Windows it requires users to download vc++ build tools which is 4.5gb+.

When the wheels get updated for 3.10, spotDL will support it.

c00ldude69 commented 2 years ago

Hi, your steps to reproduce don't look accurate! Can you confirm that this issue can happen again and again (is a reproducible issue) and can you send the EXACT command used (including album URL) here, or you can edit your original message? Sorry for the late response!

Hi Thank you for your reply. I tried it again and the issue occurred again specifically when I am trying to download two or more tracks at once. But while I am typing the same command for a single track it works just fine. But this time as I am outside of my home and low on mobile data, so didn't run my previous command fully as this would suck of 80% of mobile data at once. But I tried it with two tracks in default output format. Here is the screenshot. Screenshot 2021-10-28 130717 My previous command was spotdl https://open.spotify.com/album/4alcGHjstaALJHHiljfy3H?si=CQJhZCVIQIKWKvfUrMOwew --output-format flac --dt 16

And as you mentioned my steps don't look accurate, and always thought about that should I write the commands first and then the url or first the url and then the commands which is the right way? Can you please tell?

Silverarmor commented 2 years ago

???? Why are you doing spotdl "trackURL|trackURL", the pipe is only for specifying a youtube video to download a single song from.

  1. Can you please update your spotDL, pip install -U spotdl
  2. As I said above, please remove the --dt threads flag as your PC may be having issues.
  3. Can you also refresh your spotDL cache Del .spotdl-cache
xnetcat commented 2 years ago

The command that you used is wrong.

It should be spotdl "url1" "url2" Not spotdl "url1|url2"

c00ldude69 commented 2 years ago

Hi @Silverarmor, thank you for replying. I tried without the downloading thread but the problem remains same.

c00ldude69 commented 2 years ago

The command that you used is wrong.

It should be spotdl "url1" "url2" Not spotdl "url1|url2"

But that is how the command is written there on the README.md page no?

xnetcat commented 2 years ago

No image

Silverarmor commented 2 years ago

Closing as issue seems to be resolved, user has not gotten back.