0
我試圖讓一個文本到語音的GUI程序,這裏是我得到的錯誤,說明文件已經被另一個程序TTSpygame.mixer.quit()不工作
b = a.get()
blabla = b
tts = gTTS(text=blabla, lang='en-us')
try :
tts.save("F:/tesst.mp3")
except :
pass
pygame.init()
pygame.display.set_mode((2, 1))
try:
pygame.mixer.music.load("F:/tesst.mp3")
except :
pass
mixer.music.play(0)
clock = pygame.time.Clock()
clock.tick(10)
while pygame.mixer.music.get_busy():
pygame.event.poll()
clock.tick(10)
mixer.music.set_endevent()
mixer.quit()
os.remove("F:/tesst.mp3")
代碼,所以我無法遞歸運行程序。 這裏是錯誤
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'F:/tesst.mp3'
不工作,我得到的錯誤爲'in speak pygame.mixer.music.load(file_object) pygame.error:Could not read from RWops' –