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

FileNotFound exception when playlist/album has backward slashes #2091

Open
neufter opened this issue May 12, 2024 · 0 comments
Open

FileNotFound exception when playlist/album has backward slashes #2091

neufter opened this issue May 12, 2024 · 0 comments
Labels
Bug Unexpected problem or unintended behavior that needs to be fixed

Comments

@neufter
Copy link

neufter commented May 12, 2024

System OS

Windows

Python Version

3.11 (CPython)

Install Source

pip / PyPi

Install version / commit hash

v4.2.5

Expected Behavior vs Actual Behavior

Expected:
Songs are downloaded and a m3u file with the album/playlist name is created, with incompatible characters removed or substituted.
Actual:
FileNotFound error is produced

Steps to reproduce - Ensure to include actual links!

  1. Pick a playlist or album with backwards slashes in the name, like "C:/System32/media" as I used
  2. Use download command with --m3u {list} option
  3. Wait until m3u file is attempted to be created

Traceback

Processing query: https://open.spotify.com/intl-pt/album/1Y74BzuV0yvV3toKu2w9bW
Found 7 songs in C:\System32\media (Album)
Skipping androidWG - intro.midi (file already exists) (duplicate)
androidWG - intro.midi: Skipped
Skipping androidWG - reality_coprocessor.midi (file already exists) (duplicate)
1/7 complete
androidWG - reality_coprocessor.midi: Skipped
Skipping androidWG - intermission.midi (file already exists) (duplicate)
androidWG - intermission.midi: Skipped
3/7 complete
Skipping androidWG - architecture.midi (file already exists) (duplicate)
Skipping androidWG - my_trip_to_canada.midi (file already exists) (duplicate)
androidWG - architecture.midi: Skipped
Skipping androidWG - rest.midi (file already exists) (duplicate)
androidWG - my_trip_to_canada.midi: Skipped
5/7 complete
androidWG - rest.midi: Skipped
6/7 complete
androidWG - kakkoii.midi: Downloading
androidWG - kakkoii.midi: Embedding metadata
androidWG - kakkoii.midi: Done
7/7 complete
Downloaded "androidWG - kakkoii.midi": https://music.youtube.com/watch?v=f_oz92naOGE
An error occurred
╭──────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────╮
│ C:\Users\samu-\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotdl\console\entry_point.py:142 │
│ in console_entry_point                                                                                     │
│                                                                                                            │
│   139 │   try:                                                                                             │
│   140 │   │   # Pick the operation to perform                                                              │
│   141 │   │   # based on the name and run it!                                                              │
│ ❱ 142 │   │   OPERATIONS[arguments.operation](                                                             │
│   143 │   │   │   query=arguments.query,                                                                   │
│   144 │   │   │   downloader=downloader,                                                                   │
│   145 │   │   )                                                                                            │
│                                                                                                            │
│ C:\Users\samu-\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotdl\console\download.py:34 in  │
│ download                                                                                                   │
│                                                                                                            │
│   31 │   )                                                                                                 │
│   32 │                                                                                                     │
│   33 │   # Download the songs                                                                              │
│ ❱ 34 │   downloader.download_multiple_songs(songs)                                                         │
│   35                                                                                                       │
│                                                                                                            │
│ C:\Users\samu-\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotdl\download\downloader.py:328 │
│ in download_multiple_songs                                                                                 │
│                                                                                                            │
│   325 │   │   │   │   if path or self.settings["add_unavailable"]                                          │
│   326 │   │   │   ]                                                                                        │
│   327 │   │   │                                                                                            │
│ ❱ 328 │   │   │   gen_m3u_files(                                                                           │
│   329 │   │   │   │   song_list,                                                                           │
│   330 │   │   │   │   self.settings["m3u"],                                                                │
│   331 │   │   │   │   self.settings["output"],                                                             │
│                                                                                                            │
│ C:\Users\samu-\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotdl\utils\m3u.py:119 in        │
│ gen_m3u_files                                                                                              │
│                                                                                                            │
│   116 │   if "{list}" in file_name:                                                                        │
│   117 │   │   # Create multiple m3u files if there are multiple lists                                      │
│   118 │   │   for list_name, song_list in lists_object.items():                                            │
│ ❱ 119 │   │   │   create_m3u_file(                                                                         │
│   120 │   │   │   │   file_name.format(                                                                    │
│   121 │   │   │   │   │   list=list_name,                                                                  │
│   122 │   │   │   │   ),                                                                                   │
│                                                                                                            │
│ C:\Users\samu-\AppData\Local\Programs\Python\Python311\Lib\site-packages\spotdl\utils\m3u.py:188 in        │
│ create_m3u_file                                                                                            │
│                                                                                                            │
│   185 │   │   detect_formats,                                                                              │
│   186 │   )                                                                                                │
│   187 │                                                                                                    │
│ ❱ 188 │   with open(file_name, "w", encoding="utf-8") as m3u_file:                                         │
│   189 │   │   m3u_file.write(m3u_content)                                                                  │
│   190 │                                                                                                    │
│   191 │   return m3u_content                                                                               │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\System32\\media.m3u8'

Other details

This issue seems to happen even with --restrict ascii added

@neufter neufter added the Bug Unexpected problem or unintended behavior that needs to be fixed label May 12, 2024
@neufter neufter changed the title FileNotFound exception when playlist/album has a valid path as a name FileNotFound exception when playlist/album has backward slashes May 12, 2024
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