简体   繁体   中英

winsound not playing sound

I am trying to use winsound, but it just plays the default OS sound, meaning it cant find the path. Is there something wrong with my path? I have already tried double slashes and raw string.

winsound.PlaySound('"C:\\Users\\Admin\\OneDrive\\Documents\\Python_Projects\\Yukan_no_Shonen_Red_Number.mp3"',winsound.SND_ASYNC)

You have to use double backslash ('\\\\') to provide any kind of path in Python strings. And, by doing a quick search it seems like playsound doesn't like paths with spaces in them, so my suggestion would be to try and specify the path between double quotes like this '"full_path"' .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM