I have imported the playsound python module and put a mp3 file in the same folder as the python file, and yet when I run the file all I get is an error message saying
open Sound.mp3
Cannot find the specified file. Make sure the path and filename are correct.
Error 263 for command:
close Sound.mp3
The specified device is not open or is not recognized by MCI.
Failed to close the file: Sound.mp3
Traceback (most recent call last):
File lookup is usually relative to the current working directory and not the Python source file itself. You could either run the script from the directory with the sound file ( cd /path/to/sound_files
, python3 /path_to_script
), or pass and absolute path to the sound file when calling playsound
.
If you're using an IDE, the working directory can usually be set in the run configuration.
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.