Ich verwende PlaySound und gtts in spyder ide, das eine mp3 Datei erstellt und sie dann abspielt.
import gtts
from playsound import playsound
#pass text to gTTS object
# make request to google to get synthesis
english = gtts.gTTS("Hello world") #retrieved the actual audio speech from the API
# save the audio file
english.save("hello.mp3")
# play the audio file
playsound("hello.mp3")
< /code>
Es wird beim ersten Mal gut gespielt, zeigt dies jedoch jedes Mal, wenn ich es ausführe: < /p>
File "C:\Users\ASUS\.spyder-py3\all codes\Text2Speech.py", line 27, in
english.save("hello.mp3")
File "C:\Users\ASUS\AppData\Local\Programs\Python\Python39\Lib\site-packages\gtts\tts.py", line 312, in save
with open(str(savefile), 'wb') as f:
PermissionError: [Errno 13] Permission denied: 'hello.mp3'
< /code>
Es funktioniert wieder gut, nachdem ich Spyder neu startete und dann nach dem Spielen wieder nicht funktioniert. Mein Betriebssystem ist Windows 10, PlaySound Version 1.2.2
PlaySound spielt nur einmal die MP3 -Datei ab und gibt dann den Fehler "Erlaubnis verweigert". ⇐ Python
-
- Similar Topics
- Replies
- Views
- Last post