K
K
Karlyshev David2021-10-24 17:42:40
Python
Karlyshev David, 2021-10-24 17:42:40

Why is the Playsound library exception happening?

I want to make my own mp3 player in Pituhon, using the Playsound library to play sound. There was an exception, I can not understand what the problem is and how to solve it? Thanks in advance (I'll attach the code and the exception itself below)

import os
from  playsound  import  playsound 
import pathlib 
list_music = []
i = 1
for filename in os.listdir('./music'):
    list_music.append(filename)
    print(i, '-', filename)
    i +=1

pesnya = int(input('Выберите песню которую хотите прослушать: '))
pesnya = pesnya - 1
a = list_music[pesnya]
p = 'home/david/Документы/KsenoS.mp3/music/{}'.format(a)
print(p)
playsound(p)
print('Удачного прослушивания!')


Traceback (most recent call last):
File "/home/david/Documents/KsenoS.mp3/Code/test.py", line 16, in
playsound(p)
File "/home/david/.local/lib/python3. 8/site-packages/playsound.py", line 174, in _playsoundNix
raise PlaysoundException(u'File not found: {}'.format(path))
playsound.PlaysoundException: File not found: /home/david/Documents/KsenoS .mp3/home/david/Documents/KsenoS.mp3/music/BAX.mp3

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lz961, 2021-10-24
@lz961

p = '/home/david/Документы/KsenoS.mp3/music/{}'.format(a)

purely for sport

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question