Python module file locating issue

first let me explain you the bckground
" i am python learner and linux noobie i watched a project in python tutorial i also created but it is showing me error the person who do that project in windows in that program you have to add my music file location to play that music"

this is screenshot of program and error

I'll try later, but you don't need to double slash your path.

but the tutorial i am watching the person said to use double slash otherwise it will take it as escape sequence

i tested without double slash the same error is shown

Python understands forward-slashes on both Windows and Linux.
Also double forward-slashes at the beginning can mean a server name.

So //home/james could be trying to find a server called home with a share called james on it.

So to test:

I downloaded a sample MP3 from here.

Installed playsound using pip3

pip3 install playsound

Added the following code to tst.py

from playsound import playsound

playsound('/home/james/Downloads/sample-3s.mp3')

Ran my code

python3 tst.py

And it played the sample MP3 successfully.

Can you trying listening to the MP3 by double-clicking on it and seeing if it plays?
Check that the file is actually in /home/zsarthak/Music, noting that Linux is case-sensitive and so Music and music are two different folders.

Run the following from the command line (terminal).

ls -l /home/zsarthak/Music

Do you see your file or do you get an error like

ls: cannot access '/home/zsarthak/Music': No such file or directory

Change directory to the parent (where the script is) and you should be able to use python play.py . You don't need the FQDN of you're in that directory.

Be careful not to use directory names with spaces, otherwise you may need to use quotes around that portion of the path when defining location of the script.

bro explain in easy language i am just starter with linux please don't use heavy words like fqdn
pls give steps and i'll follow it

hey i understand what mistakes i am doing i am only adding path of file not the file name with i just add path then a slash and song name with .mp3 and it worked properly and a lot of thanks for you you helped me alot

FQDN - Full Qualified Domain Name

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.