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

FileNotFoundError when a playlists contains slashes on its name #2284

Open
lucidtyper opened this issue Jan 24, 2025 · 0 comments
Open

FileNotFoundError when a playlists contains slashes on its name #2284

lucidtyper opened this issue Jan 24, 2025 · 0 comments
Labels
Bug Unexpected problem or unintended behavior that needs to be fixed

Comments

@lucidtyper
Copy link

System OS

Windows

Python Version

3.13 (CPython)

Install Source

pip / PyPi

Install version / commit hash

4.2.11

Expected Behavior vs Actual Behavior

The expected behavior was getting the m3u8 for that playlist, but instead got an error of FileNotFound with the slashes converted to double backslashes.

Steps to reproduce - Ensure to include actual links!

  1. Command inputted: spotdl download all-user-playlists --user-auth --m3u "{list}"
  2. Every song seems to get downloaded
  3. Gets crashed when the program finds a playlists containing slashes (/)

Traceback

An error occurred
╭───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────╮
│ C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\site-packages\spotdl\console\entry_point.py:160 in        │
│ entry_point                                                                                                          │
│                                                                                                                      │
│   157 │   try:                                                                                                       │
│   158 │   │   # Pick the operation to perform                                                                        │
│   159 │   │   # based on the name and run it!                                                                        │
│ ❱ 160 │   │   OPERATIONS[arguments.operation](                                                                       │
│   161 │   │   │   query=arguments.query,                                                                             │
│   162 │   │   │   downloader=downloader,                                                                             │
│   163 │   │   )                                                                                                      │
│                                                                                                                      │
│ C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\site-packages\spotdl\console\download.py:35 in download   │
│                                                                                                                      │
│   32 │   )                                                                                                           │
│   33 │                                                                                                               │
│   34 │   # Download the songs                                                                                        │
│ ❱ 35 │   downloader.download_multiple_songs(songs)                                                                   │
│   36                                                                                                                 │
│                                                                                                                      │
│ C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\site-packages\spotdl\download\downloader.py:339 in        │
│ download_multiple_songs                                                                                              │
│                                                                                                                      │
│   336 │   │   │   │   if path or self.settings["add_unavailable"]                                                    │
│   337 │   │   │   ]                                                                                                  │
│   338 │   │   │                                                                                                      │
│ ❱ 339 │   │   │   gen_m3u_files(                                                                                     │
│   340 │   │   │   │   song_list,                                                                                     │
│   341 │   │   │   │   self.settings["m3u"],                                                                          │
│   342 │   │   │   │   self.settings["output"],                                                                       │
│                                                                                                                      │
│ C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\site-packages\spotdl\utils\m3u.py:123 in gen_m3u_files    │
│                                                                                                                      │
│   120 │   if "{list}" in file_name:                                                                                  │
│   121 │   │   # Create multiple m3u files if there are multiple lists                                                │
│   122 │   │   for list_name, song_list in lists_object.items():                                                      │
│ ❱ 123 │   │   │   create_m3u_file(                                                                                   │
│   124 │   │   │   │   file_name.format(                                                                              │
│   125 │   │   │   │   │   list=list_name,                                                                            │
│   126 │   │   │   │   ),                                                                                             │
│                                                                                                                      │
│ C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\site-packages\spotdl\utils\m3u.py:196 in create_m3u_file  │
│                                                                                                                      │
│   193 │   │   *(sanitize_string(part) for part in Path(file_name).parts)                                             │
│   194 │   ).absolute()                                                                                               │
│   195 │                                                                                                              │
│ ❱ 196 │   with open(file_path, "w", encoding="utf-8") as m3u_file:                                                   │
│   197 │   │   m3u_file.write(m3u_content)                                                                            │
│   198 │                                                                                                              │
│   199 │   return m3u_content                                                                                         │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\musicaOffline\\init 3 - Neutral\\Happy.m3u8'

Other details

This issue also happens on Linux (Arch Linux) with the same install method (pip).

@lucidtyper lucidtyper added the Bug Unexpected problem or unintended behavior that needs to be fixed label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Unexpected problem or unintended behavior that needs to be fixed
Projects
None yet
Development

No branches or pull requests

1 participant