1

I tried to add a beep to my code to remind the change of data. so I build a sound module using playsound and Play_mp3. It works well separately, but when called in the main function, it reported:

Error 259 for command:
  play "C:\Users\LYX\spider_demo\spider_demo\msn.mp3" wait

Said that The driver cannot recognize the specified command parameter.

Error 305 for command:
   close "C:\Users\LYX\spider_demo\spider_demo\msn.mp3"

Said that no extra characters can be specified in the string enclosed in quotation marks.

The beep module looks like this:

from playsound import playsound

def beep():
    file = r'C:\Users\LYX\spider_demo\spider_demo\msn.mp3'
    file2 = r'C:\Users\LYX\Desktop\Web Spider\audio\msn.mp3'
    playsound(file2)
import Play_mp3

def beep():
    sound = r'C:\Users\LYX\Desktop\Web Spider\audio\msn.mp3'
    Play_mp3.play(sound)

I tried both ways, and not working. BTW for the playsound module, the playsound(file2) works well separately but when I put the mp3 file into the virtual env, playsound(file) it raised the error above. How can I fix this? Is it related to the Python virtual env?

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
Leo_Liu
  • 37
  • 5

0 Answers0