-1

This is my code:

from playsound import playsound

playsound(r'C:\Users\owner\Downloads\BotW Item.mp3')

And this is the error I get:

screenshot of my error

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
  • Please avoid posting images (or worse, links to images) of code or errors. Anything text-based (code and errors) should be posted as text directly in the question itself and formatted properly as a [mre]. You can get more [formatting help here](https://stackoverflow.com/help/formatting). You can also read about [why you shouldn't post images/links of code](//meta.stackoverflow.com/q/285551). – Tomerikoo Oct 03 '21 at 13:41

1 Answers1

0

Try it like this: r'C:\\Users\\owner\\Downloads\\BotW Item.mp3' or just add one of them i.e like this: r'C:\\Users\owner\Downloads\BotW Item.mp3'. You have to escape the \ character and the escape sequence for it in python is :\\. If this doesn't work you can use os module:

import os
os.startfile('C:\\Users\\owner\\Downloads\\BotW Item.mp3')

Also regarding the playsound module, you should import it like this:

from playsound import playsound
playsound('C:\\Users\\owner\\Downloads\\BotW Item.mp3')
Theorist
  • 159
  • 1
  • 8