[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Re: Pygame doesn't close properly so I can't delete the file it's using
On 28.05.2017 17:57, Gameskiller01 wrote:
def input_for_tts(message):
try:
tts = gTTS(text = input(message))
tts.save('Text To Speech.mp3')
audio = MP3(my_file)
audio_length = audio.info.length
try:
pygame.mixer.init()
except pygame.error:
print("\nSorry, no audio device was detected. The code cannot
complete.")
exiting()
bp = pyglet.resource.media(my_file)
bp.play()
Hi there
Isn't that code playing the file using pyglet?
bp = pyglet.resource.media(my_file)
bp.play()
I wonder, why and what are you using pyglet for?
I don't think that pyglet is using pygame as a audio backend... but I
might be wrong, but pyglet might lock the file (or whatever backend
pyglet is using for audio).
Maybe try to remove pyglet (since its only used to play the file?) and
see how it goes.
Or I may ask the other way around: why and what are you using pygame for?
If the reason you are using pyglet is because it can play mp3 and pygame
can't, then why bother with pygame at all?
Maybe one of my question will help you figure the problem out.
~DR0ID